Blockwell

LucidSight-MLB-NFT

About

Stats

Public Functions 74
Event Types 6
Code Size 82,042 bytes

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

AssetUpdated Event

Parameters help
tokenId
uint256 help

ContractUpgrade Event

Parameters help
newContract
address help

Created Event

Parameters help
owner
address help
tokenId
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_tokenId
uint256 help

InterfaceSignature_ERC165 Constant

bytes4 help
0x01ffc9a7

InterfaceSignature_ERC721Enumerable Constant

bytes4 help
0x780e9d63

InterfaceSignature_ERC721Metadata Constant

bytes4 help
0x5b5e139f

InterfaceSignature_ERC721 Constant

bytes4 help
0x80ac58cd

InterfaceSignature_ERC721Optional Constant

bytes4 help
UNKNOWN VALUE

ERC721_RECEIVED Constant

bytes4 help
0x150b7a02

newContractAddress Variable

address help

detachmentTime Variable

uint32 help

attachedSystemActive Variable

bool help

saleManagerAddress Variable

address help

rewardsRedeemed Variable

uint256 help

seedCreatedCount Variable

uint256 help

isBatchSupported Variable

bool help

managerPrimary Variable

address help

managerSecondary Variable

address help

bankManager Variable

address help

paused Variable

bool help

error Variable

bool help

contractsApprovedList Variable

mapping(address => bool) help

nftTeamIndexToCollectibleCount Variable

mapping(uint256 => uint32) help

generationSeasonController Variable

mapping(uint256 => uint256) help

generationSeasonDict Variable

mapping(uint256 => uint256) help

otherManagers Variable

mapping(address => uint8) help

promoCreatedCount Variable

uint256[] help
Internal Variable

nftTeamIdToSequenceIdToCollectible Variable

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

nftCollectibleAttachments Variable

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

allNFTs Variable

NFT[] help
Internal Variable

name_ Variable

string help
Internal Variable

symbol_ Variable

string 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

tokenURIBase Variable

string 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

Functions Expand All Collapse All

setPrimaryManager keyboard_arrow_up

Parameters help

Name Type
_newGM
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setPrimaryManager(address _newGM) external onlyManager {
  require(_newGM != address(0));

  managerPrimary = _newGM;
}

setSecondaryManager keyboard_arrow_up

Parameters help

Name Type
_newGM
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setSecondaryManager(address _newGM) external onlyManager {
  require(_newGM != address(0));

  managerSecondary = _newGM;
}

setBanker keyboard_arrow_up

Parameters help

Name Type
_newBK
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setBanker(address _newBK) external onlyManager {
  require(_newBK != address(0));

  bankManager = _newBK;
}

setOtherManager keyboard_arrow_up

Parameters help

Name Type
_newOp
address help
_state
uint8 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setOtherManager(address _newOp, uint8 _state) external onlyManager {
  require(_newOp != address(0));

  otherManagers[_newOp] = _state;
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function pause() external onlyManager whenNotPaused {
  paused = true;
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function unpause() public onlyManager {
  /// Actually unpause the contract.
  super.unpause();
}

hasError keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function hasError() public onlyManager whenPaused {
  error = true;
}

noError keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function noError() public onlyManager whenPaused {
  error = false;
}

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

exists keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function exists(uint256 _tokenId) public view returns (bool) {
  address owner = tokenOwner[_tokenId];
  return owner != address(0);
}

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);
  require(msg.sender == owner || isApprovedForAll(owner, msg.sender));

  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
Source Code
function getApproved(uint256 _tokenId) public view returns (address) {
  return tokenApprovals[_tokenId];
}

setApprovalForAll keyboard_arrow_up

Parameters help

Name Type
_to
address help
_approved
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function setApprovalForAll(address _to, bool _approved) public {
  require(_to != msg.sender);
  operatorApprovals[msg.sender][_to] = _approved;
  emit ApprovalForAll(msg.sender, _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

Modifiers help

canTransfer checks for the following:

Requirements help

Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _tokenId
) public canTransfer(_tokenId) {
  // Asset should not be in play
  require(checkIsAttached(_tokenId) == 0);

  require(_from != address(0));

  require(_to != address(0));

  clearApproval(_from, _tokenId);
  removeTokenFrom(_from, _tokenId);
  addTokenTo(_to, _tokenId);

  emit Transfer(_from, _to, _tokenId);
}

safeTransferFrom keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

canTransfer checks for the following:
null

Requirements help

null
Source Code
function safeTransferFrom(
  address _from,
  address _to,
  uint256 _tokenId
) public canTransfer(_tokenId) {
  // solium-disable-next-line arg-overflow
  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

Modifiers help

canTransfer checks for the following:
null

Requirements help

null
Source Code
function safeTransferFrom(
  address _from,
  address _to,
  uint256 _tokenId,
  bytes _data
) public canTransfer(_tokenId) {
  transferFrom(_from, _to, _tokenId);
  // solium-disable-next-line arg-overflow
  require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));
}

Parameters help

This function has no parameters.

Properties

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

Parameters help

This function has no parameters.

Properties

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

tokenURI keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

null
Source Code
function tokenURI(uint256 _tokenId) public view returns (string) {
  require(exists(_tokenId));
  return tokenURIBase;
}

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

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 ((_interfaceID == InterfaceSignature_ERC165) ||
    (_interfaceID == InterfaceSignature_ERC721) ||
    (_interfaceID == InterfaceSignature_ERC721Enumerable) ||
    (_interfaceID == InterfaceSignature_ERC721Metadata));
}

implementsERC721 keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

isLSNFT keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

tokensOfOwner keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help view
Source Code
function tokensOfOwner(address _owner)
  external
  view
  returns (uint256[] ownerTokens)
{
  uint256 tokenCount = balanceOf(_owner);

  if (tokenCount == 0) {
    // Return an empty array
    return new uint256[](0);
  } else {
    uint256[] memory result = new uint256[](tokenCount);
    uint256 totalItems = balanceOf(_owner);
    uint256 resultIndex = 0;

    // We count on the fact that all Collectible have IDs starting at 0 and increasing
    // sequentially up to the total count.
    uint256 _assetId;

    for (_assetId = 0; _assetId < totalItems; _assetId++) {
      result[resultIndex] = tokenOfOwnerByIndex(_owner, _assetId);
      resultIndex++;
    }

    return result;
  }
}

updateBatchSupport keyboard_arrow_up

Parameters help

Name Type
_flag
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateBatchSupport(bool _flag) public onlyManager {
  isBatchSupported = _flag;
}

addToApproveList keyboard_arrow_up

Parameters help

Name Type
_newAddress
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function addToApproveList(address _newAddress) public onlyManager {
  require(!contractsApprovedList[_newAddress]);
  contractsApprovedList[_newAddress] = true;
}

removeFromApproveList keyboard_arrow_up

Parameters help

Name Type
_newAddress
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function removeFromApproveList(address _newAddress) public onlyManager {
  require(contractsApprovedList[_newAddress]);
  delete contractsApprovedList[_newAddress];
}

createPromoCollectible keyboard_arrow_up

Parameters help

Name Type
_teamId
uint8 help
_posId
uint8 help
_attributes
uint256 help
_owner
address help
_gameId
uint256 help
_playerOverrideId
uint256 help
_mlbPlayerId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function createPromoCollectible(
  uint8 _teamId,
  uint8 _posId,
  uint256 _attributes,
  address _owner,
  uint256 _gameId,
  uint256 _playerOverrideId,
  uint256 _mlbPlayerId
) external canCreate whenNotPaused returns (uint256) {
  address nftOwner = _owner;
  if (nftOwner == address(0)) {
    nftOwner = managerPrimary;
  }

  if (allNFTs.length > 0) {
    promoCreatedCount[_teamId]++;
  }

  uint32 _sequenceId = getSequenceId(_teamId);

  uint256 assetDetails = uint256(uint64(now));
  assetDetails |= uint256(_sequenceId) << 64;
  assetDetails |= uint256(_teamId) << 96;
  assetDetails |= uint256(_posId) << 104;

  uint256[5] memory _nftData = [
    assetDetails,
    _attributes,
    _gameId,
    _playerOverrideId,
    _mlbPlayerId
  ];

  return _createNFTCollectible(_teamId, _attributes, nftOwner, 0, _nftData);
}

createSeedCollectible keyboard_arrow_up

Parameters help

Name Type
_teamId
uint8 help
_posId
uint8 help
_attributes
uint256 help
_owner
address help
_gameId
uint256 help
_playerOverrideId
uint256 help
_mlbPlayerId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function createSeedCollectible(
  uint8 _teamId,
  uint8 _posId,
  uint256 _attributes,
  address _owner,
  uint256 _gameId,
  uint256 _playerOverrideId,
  uint256 _mlbPlayerId
) external canCreate whenNotPaused returns (uint256) {
  address nftOwner = _owner;

  if (nftOwner == address(0)) {
    nftOwner = managerPrimary;
  }

  seedCreatedCount++;
  uint32 _sequenceId = getSequenceId(_teamId);

  uint256 assetDetails = uint256(uint64(now));
  assetDetails |= uint256(_sequenceId) << 64;
  assetDetails |= uint256(_teamId) << 96;
  assetDetails |= uint256(_posId) << 104;

  uint256[5] memory _nftData = [
    assetDetails,
    _attributes,
    _gameId,
    _playerOverrideId,
    _mlbPlayerId
  ];

  return _createNFTCollectible(_teamId, _attributes, nftOwner, 0, _nftData);
}

createRewardCollectible keyboard_arrow_up

Parameters help

Name Type
_teamId
uint8 help
_posId
uint8 help
_attributes
uint256 help
_owner
address help
_gameId
uint256 help
_playerOverrideId
uint256 help
_mlbPlayerId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function createRewardCollectible(
  uint8 _teamId,
  uint8 _posId,
  uint256 _attributes,
  address _owner,
  uint256 _gameId,
  uint256 _playerOverrideId,
  uint256 _mlbPlayerId
) external canCreate whenNotPaused returns (uint256) {
  address nftOwner = _owner;

  if (nftOwner == address(0)) {
    nftOwner = managerPrimary;
  }

  rewardsRedeemed++;
  uint32 _sequenceId = getSequenceId(_teamId);

  uint256 assetDetails = uint256(uint64(now));
  assetDetails |= uint256(_sequenceId) << 64;
  assetDetails |= uint256(_teamId) << 96;
  assetDetails |= uint256(_posId) << 104;

  uint256[5] memory _nftData = [
    assetDetails,
    _attributes,
    _gameId,
    _playerOverrideId,
    _mlbPlayerId
  ];

  return _createNFTCollectible(_teamId, _attributes, nftOwner, 0, _nftData);
}

createETHCardCollectible keyboard_arrow_up

Parameters help

Name Type
_teamId
uint8 help
_posId
uint8 help
_attributes
uint256 help
_owner
address help
_gameId
uint256 help
_playerOverrideId
uint256 help
_mlbPlayerId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function createETHCardCollectible(
  uint8 _teamId,
  uint8 _posId,
  uint256 _attributes,
  address _owner,
  uint256 _gameId,
  uint256 _playerOverrideId,
  uint256 _mlbPlayerId
) external canCreate whenNotPaused returns (uint256) {
  address nftOwner = _owner;

  if (nftOwner == address(0)) {
    nftOwner = managerPrimary;
  }

  rewardsRedeemed++;
  uint32 _sequenceId = getSequenceId(_teamId);

  uint256 assetDetails = uint256(uint64(now));
  assetDetails |= uint256(_sequenceId) << 64;
  assetDetails |= uint256(_teamId) << 96;
  assetDetails |= uint256(_posId) << 104;

  uint256[5] memory _nftData = [
    assetDetails,
    _attributes,
    _gameId,
    _playerOverrideId,
    _mlbPlayerId
  ];

  return _createNFTCollectible(_teamId, _attributes, nftOwner, 2, _nftData);
}

setSaleManagerAddress keyboard_arrow_up

Parameters help

Name Type
_saleManagerAddress
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setSaleManagerAddress(address _saleManagerAddress) public onlyManager {
  require(_saleManagerAddress != address(0));
  saleManagerAddress = SaleManager(_saleManagerAddress);
}

setNewAddress keyboard_arrow_up

Parameters help

Name Type
_v2Address
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setNewAddress(address _v2Address) external onlyManager {
  require(_v2Address != address(0));
  newContractAddress = _v2Address;
  emit ContractUpgrade(_v2Address);
}

getCollectibleDetails keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getCollectibleDetails(uint256 _tokenId)
  external
  view
  returns (
    uint256 isAttached,
    uint32 sequenceId,
    uint8 teamId,
    uint8 positionId,
    uint64 creationTime,
    uint256 attributes,
    uint256 playerOverrideId,
    uint256 mlbGameId,
    uint256 currentGameCardId,
    uint256 mlbPlayerId,
    uint256 earnedBy,
    uint256 generationSeason
  )
{
  NFT memory obj = _getAttributesOfToken(_tokenId);

  attributes = obj.attributes;
  currentGameCardId = obj.currentGameCardId;
  mlbGameId = obj.mlbGameId;
  playerOverrideId = obj.playerOverrideId;
  mlbPlayerId = obj.mlbPlayerId;

  creationTime = uint64(obj.assetDetails);
  sequenceId = uint32(obj.assetDetails >> 64);
  teamId = uint8(obj.assetDetails >> 96);
  positionId = uint8(obj.assetDetails >> 104);
  isAttached = obj.isAttached;
  earnedBy = obj.earnedBy;

  generationSeason = generationSeasonDict[(obj.attributes % 1000000) / 1000];
}

getTeamId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getTeamId(uint256 _tokenId) external view returns (uint256) {
  NFT memory obj = _getAttributesOfToken(_tokenId);

  uint256 teamId = uint256(uint8(obj.assetDetails >> 96));
  return uint256(teamId);
}

getPositionId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getPositionId(uint256 _tokenId) external view returns (uint256) {
  NFT memory obj = _getAttributesOfToken(_tokenId);

  uint256 positionId = uint256(uint8(obj.assetDetails >> 104));

  return positionId;
}

getGameCardId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getGameCardId(uint256 _tokenId) public view returns (uint256) {
  NFT memory obj = _getAttributesOfToken(_tokenId);
  return obj.currentGameCardId;
}

checkIsAttached keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function checkIsAttached(uint256 _tokenId) public view returns (uint256) {
  NFT memory obj = _getAttributesOfToken(_tokenId);
  return obj.isAttached;
}

getAbilitiesForCollectibleId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getAbilitiesForCollectibleId(uint256 _tokenId)
  external
  view
  returns (uint256 ability)
{
  NFT memory obj = _getAttributesOfToken(_tokenId);
  uint256 _attributes = uint256(obj.attributes);
  ability = (_attributes % 1000);
}

updateCurrentGameCardId keyboard_arrow_up

Parameters help

Name Type
_gameCardNumber
uint256 help
_playerId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateCurrentGameCardId(uint256 _gameCardNumber, uint256 _playerId)
  public
  whenNotPaused
{
  require(contractsApprovedList[msg.sender]);

  NFT memory obj = _getAttributesOfToken(_playerId);

  obj.currentGameCardId = _gameCardNumber;

  if (_gameCardNumber == 0) {
    obj.isAttached = 0;
  } else {
    obj.isAttached = 1;
  }

  allNFTs[_playerId] = obj;
}

addAttachmentToCollectible keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_attachment
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function addAttachmentToCollectible(uint256 _tokenId, uint256 _attachment)
  external
  onlyManager
  whenNotPaused
{
  require(exists(_tokenId));

  nftCollectibleAttachments[_tokenId].push(_attachment);
  emit AssetUpdated(_tokenId);
}

removeAllAttachmentsFromCollectible keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function removeAllAttachmentsFromCollectible(uint256 _tokenId)
  external
  onlyManager
  whenNotPaused
{
  require(exists(_tokenId));

  delete nftCollectibleAttachments[_tokenId];
  emit AssetUpdated(_tokenId);
}

giftAsset keyboard_arrow_up

Parameters help

Name Type
_to
address help
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

null
Source Code
function giftAsset(address _to, uint256 _tokenId) public whenNotPaused {
  safeTransferFrom(msg.sender, _to, _tokenId);
}

setTokenURIBase keyboard_arrow_up

Parameters help

Name Type
_tokenURI
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function setTokenURIBase(string _tokenURI) public anyOperator {
  _setTokenURIBase(_tokenURI);
}

setPlayerOverrideId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_newOverrideId
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function setPlayerOverrideId(uint256 _tokenId, uint256 _newOverrideId)
  public
  onlyManager
  whenNotPaused
{
  require(exists(_tokenId));

  _updatePlayerOverrideId(_tokenId, _newOverrideId);
}

updateGenerationStopTime keyboard_arrow_up

Parameters help

Name Type
_season
uint256 help
_value
uint8 help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateGenerationStopTime(uint256 _season, uint8 _value)
  public
  onlyManager
  whenNotPaused
{
  require(generationSeasonController[_season] == 1 && _value != 0);
  _updateGenerationSeasonFlag(_season, _value);
}

setGenerationSeasonController keyboard_arrow_up

Parameters help

Name Type
_season
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function setGenerationSeasonController(uint256 _season)
  public
  onlyManager
  whenNotPaused
{
  require(generationSeasonController[_season] == 0);
  _updateGenerationSeasonFlag(_season, 1);
}

updateGenerationDict keyboard_arrow_up

Parameters help

Name Type
_season
uint256 help
_value
uint64 help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateGenerationDict(uint256 _season, uint64 _value)
  public
  onlyManager
  whenNotPaused
{
  require(generationSeasonDict[_season] <= 1);
  generationSeasonDict[_season] = _value;
}

getPlayerId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getPlayerId(uint256 _tokenId)
  external
  view
  returns (uint256 playerId)
{
  NFT memory obj = _getAttributesOfToken(_tokenId);
  playerId = ((obj.attributes.div(100000000000000000)) % 1000);
}

getAssetAttachment keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getAssetAttachment(uint256 _tokenId)
  external
  view
  returns (uint256[])
{
  uint256[] _attachments = nftCollectibleAttachments[_tokenId];
  uint256[] attachments;
  for (uint256 i = 0; i < _attachments.length; i++) {
    attachments.push(_attachments[i]);
  }

  return attachments;
}

updateEarnedBy keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_earnedBy
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function updateEarnedBy(uint256 _tokenId, uint256 _earnedBy)
  public
  onlyManager
  whenNotPaused
{
  require(exists(_tokenId));

  _updateEarnedBy(_tokenId, _earnedBy);
}

batchCreateAsset keyboard_arrow_up

Parameters help

Name Type
_teamId
uint8[] help
_attributes
uint256[] help
_playerOverrideId
uint256[] help
_mlbPlayerId
uint256[] help
_to
address[] help

Properties

Visibility help public
Mutability help transaction
Source Code
function batchCreateAsset(
  uint8[] _teamId,
  uint256[] _attributes,
  uint256[] _playerOverrideId,
  uint256[] _mlbPlayerId,
  address[] _to
) external canCreate whenNotPaused {
  require(isBatchSupported);

  require(
    _teamId.length > 0 &&
      _attributes.length > 0 &&
      _playerOverrideId.length > 0 &&
      _mlbPlayerId.length > 0 &&
      _to.length > 0
  );

  uint256 assetDetails;
  uint256[5] memory _nftData;

  for (uint256 ii = 0; ii < _attributes.length; ii++) {
    require(
      _to[ii] != address(0) &&
        _teamId[ii] != 0 &&
        _attributes.length != 0 &&
        _mlbPlayerId[ii] != 0
    );

    assetDetails = uint256(uint64(now));
    assetDetails |= uint256(getSequenceId(_teamId[ii])) << 64;
    assetDetails |= uint256(_teamId[ii]) << 96;
    assetDetails |=
      uint256(
        (_attributes[ii] / 1000000000000000000000000000000000000000) - 800
      ) <<
      104;

    _nftData = [
      assetDetails,
      _attributes[ii],
      0,
      _playerOverrideId[ii],
      _mlbPlayerId[ii]
    ];

    _createNFTCollectible(_teamId[ii], _attributes[ii], _to[ii], 0, _nftData);
  }
}

batchCreateETHCardAsset keyboard_arrow_up

Parameters help

Name Type
_teamId
uint8[] help
_attributes
uint256[] help
_playerOverrideId
uint256[] help
_mlbPlayerId
uint256[] help
_to
address[] help

Properties

Visibility help public
Mutability help transaction
Source Code
function batchCreateETHCardAsset(
  uint8[] _teamId,
  uint256[] _attributes,
  uint256[] _playerOverrideId,
  uint256[] _mlbPlayerId,
  address[] _to
) external canCreate whenNotPaused {
  require(isBatchSupported);

  require(
    _teamId.length > 0 &&
      _attributes.length > 0 &&
      _playerOverrideId.length > 0 &&
      _mlbPlayerId.length > 0 &&
      _to.length > 0
  );

  uint256 assetDetails;
  uint256[5] memory _nftData;

  for (uint256 ii = 0; ii < _attributes.length; ii++) {
    require(
      _to[ii] != address(0) &&
        _teamId[ii] != 0 &&
        _attributes.length != 0 &&
        _mlbPlayerId[ii] != 0
    );

    assetDetails = uint256(uint64(now));
    assetDetails |= uint256(getSequenceId(_teamId[ii])) << 64;
    assetDetails |= uint256(_teamId[ii]) << 96;
    assetDetails |=
      uint256(
        (_attributes[ii] / 1000000000000000000000000000000000000000) - 800
      ) <<
      104;

    _nftData = [
      assetDetails,
      _attributes[ii],
      0,
      _playerOverrideId[ii],
      _mlbPlayerId[ii]
    ];

    _createNFTCollectible(_teamId[ii], _attributes[ii], _to[ii], 2, _nftData);
  }
}

multiBatchTransferFrom keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help
_fromB
address[] help
_toB
address[] help

Properties

Visibility help public
Mutability help transaction
Source Code
function multiBatchTransferFrom(
  uint256[] _tokenIds,
  address[] _fromB,
  address[] _toB
) public {
  require(isBatchSupported);

  require(_tokenIds.length > 0 && _fromB.length > 0 && _toB.length > 0);

  uint256 _id;
  address _to;
  address _from;

  for (uint256 i = 0; i < _tokenIds.length; ++i) {
    require(_tokenIds[i] != 0 && _fromB[i] != 0 && _toB[i] != 0);

    _id = _tokenIds[i];
    _to = _toB[i];
    _from = _fromB[i];

    transferFrom(_from, _to, _id);
  }
}

batchTransferFrom keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help
_from
address help
_to
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function batchTransferFrom(
  uint256[] _tokenIds,
  address _from,
  address _to
) public {
  require(isBatchSupported);

  require(_tokenIds.length > 0 && _from != address(0) && _to != address(0));

  uint256 _id;

  for (uint256 i = 0; i < _tokenIds.length; ++i) {
    require(_tokenIds[i] != 0);

    _id = _tokenIds[i];

    transferFrom(_from, _to, _id);
  }
}

multiBatchSafeTransferFrom keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help
_fromB
address[] help
_toB
address[] help

Properties

Visibility help public
Mutability help transaction
Source Code
function multiBatchSafeTransferFrom(
  uint256[] _tokenIds,
  address[] _fromB,
  address[] _toB
) public {
  require(isBatchSupported);

  require(_tokenIds.length > 0 && _fromB.length > 0 && _toB.length > 0);

  uint256 _id;
  address _to;
  address _from;

  for (uint256 i = 0; i < _tokenIds.length; ++i) {
    require(_tokenIds[i] != 0 && _fromB[i] != 0 && _toB[i] != 0);

    _id = _tokenIds[i];
    _to = _toB[i];
    _from = _fromB[i];

    safeTransferFrom(_from, _to, _id);
  }
}

batchSafeTransferFrom keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help
_from
address help
_to
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function batchSafeTransferFrom(
  uint256[] _tokenIds,
  address _from,
  address _to
) public {
  require(isBatchSupported);

  require(_tokenIds.length > 0 && _from != address(0) && _to != address(0));

  uint256 _id;
  for (uint256 i = 0; i < _tokenIds.length; ++i) {
    require(_tokenIds[i] != 0);
    _id = _tokenIds[i];
    safeTransferFrom(_from, _to, _id);
  }
}

batchApprove keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help
_spender
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function batchApprove(uint256[] _tokenIds, address _spender) public {
  require(isBatchSupported);

  require(_tokenIds.length > 0 && _spender != address(0));

  uint256 _id;
  for (uint256 i = 0; i < _tokenIds.length; ++i) {
    require(_tokenIds[i] != 0);

    _id = _tokenIds[i];
    approve(_spender, _id);
  }
}

batchSetApprovalForAll keyboard_arrow_up

Parameters help

Name Type
_spenders
address[] help
_approved
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function batchSetApprovalForAll(address[] _spenders, bool _approved) public {
  require(isBatchSupported);

  require(_spenders.length > 0);

  address _spender;
  for (uint256 i = 0; i < _spenders.length; ++i) {
    require(address(_spenders[i]) != address(0));

    _spender = _spenders[i];
    setApprovalForAll(_spender, _approved);
  }
}

requestDetachment keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function requestDetachment(uint256 _tokenId) public {
  //Request can only be made by owner or approved address
  require(isApprovedOrOwner(msg.sender, _tokenId));

  uint256 isAttached = checkIsAttached(_tokenId);

  //If collectible is on a gamecard prevent detachment
  require(getGameCardId(_tokenId) == 0);

  require(isAttached >= 1);

  if (attachedSystemActive == true) {
    //Checks to see if request was made and if time elapsed
    if (isAttached > 1 && block.timestamp - isAttached > detachmentTime) {
      isAttached = 0;
    } else if (isAttached > 1) {
      //Forces Tx Fail if time is already set for attachment and not less than detachmentTime
      require(isAttached == 1);
    } else {
      //Is attached, set detachment time and make request to detach
      // emit AssetUpdated(_tokenId);
      isAttached = block.timestamp;
    }
  } else {
    isAttached = 0;
  }

  updateIsAttached(_tokenId, isAttached);
}

attachAsset keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

canTransfer checks for the following:

Requirements help

Source Code
function attachAsset(uint256 _tokenId) public canTransfer(_tokenId) {
  uint256 isAttached = checkIsAttached(_tokenId);

  require(isAttached == 0);
  isAttached = 1;

  updateIsAttached(_tokenId, isAttached);

  emit AssetUpdated(_tokenId);
}

batchAttachAssets keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function batchAttachAssets(uint256[] _tokenIds) public {
  require(isBatchSupported);

  for (uint256 i = 0; i < _tokenIds.length; i++) {
    attachAsset(_tokenIds[i]);
  }
}

batchDetachAssets keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function batchDetachAssets(uint256[] _tokenIds) public {
  require(isBatchSupported);

  for (uint256 i = 0; i < _tokenIds.length; i++) {
    requestDetachment(_tokenIds[i]);
  }
}

requestDetachmentOnPause keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

null
Source Code
function requestDetachmentOnPause(uint256 _tokenId) public whenPaused {
  //Request can only be made by owner or approved address
  require(isApprovedOrOwner(msg.sender, _tokenId));

  updateIsAttached(_tokenId, 0);
}

toggleAttachedEnforcement keyboard_arrow_up

Parameters help

Name Type
_state
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function toggleAttachedEnforcement(bool _state) public onlyManager {
  attachedSystemActive = _state;
}

setDetachmentTime keyboard_arrow_up

Parameters help

Name Type
_time
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setDetachmentTime(uint256 _time) public onlyManager {
  //Detactment Time can not be set greater than 2 weeks.
  require(_time <= 1209600);
  detachmentTime = uint32(_time);
}

setNFTDetached keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function setNFTDetached(uint256 _tokenId) public anyOperator {
  require(checkIsAttached(_tokenId) > 0);

  updateIsAttached(_tokenId, 0);
}

setBatchDetachCollectibles keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function setBatchDetachCollectibles(uint256[] _tokenIds) public anyOperator {
  uint256 _id;
  for (uint256 i = 0; i < _tokenIds.length; i++) {
    _id = _tokenIds[i];
    setNFTDetached(_id);
  }
}

initiateCreateSale keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_startingPrice
uint256 help
_endingPrice
uint256 help
_duration
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function initiateCreateSale(
  uint256 _tokenId,
  uint256 _startingPrice,
  uint256 _endingPrice,
  uint256 _duration
) external {
  require(_tokenId != 0);

  // If MLBNFT is already on any sale, this will throw
  // because it will be owned by the sale contract.
  address owner = ownerOf(_tokenId);
  require(owner == msg.sender);

  // Sale contract checks input sizes
  require(_startingPrice == _startingPrice);
  require(_endingPrice == _endingPrice);
  require(_duration == _duration);

  require(checkIsAttached(_tokenId) == 0);

  // One time approval for the tokenID
  _approveForSale(msg.sender, address(saleManagerAddress), _tokenId);

  saleManagerAddress.createSale(
    _tokenId,
    _startingPrice,
    _endingPrice,
    _duration,
    msg.sender
  );
}

batchCreateAssetSale keyboard_arrow_up

Parameters help

Name Type
_tokenIds
uint256[] help
_startingPrices
uint256[] help
_endingPrices
uint256[] help
_durations
uint256[] help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function batchCreateAssetSale(
  uint256[] _tokenIds,
  uint256[] _startingPrices,
  uint256[] _endingPrices,
  uint256[] _durations
) external whenNotPaused {
  require(
    _tokenIds.length > 0 &&
      _startingPrices.length > 0 &&
      _endingPrices.length > 0 &&
      _durations.length > 0
  );

  // Sale contract checks input sizes
  for (uint256 ii = 0; ii < _tokenIds.length; ii++) {
    // Do not process for tokenId 0
    require(_tokenIds[ii] != 0);

    require(_startingPrices[ii] == _startingPrices[ii]);
    require(_endingPrices[ii] == _endingPrices[ii]);
    require(_durations[ii] == _durations[ii]);

    // If MLBNFT is already on any sale, this will throw
    // because it will be owned by the sale contract.
    address _owner = ownerOf(_tokenIds[ii]);
    address _msgSender = msg.sender;
    require(_owner == _msgSender);

    // Check whether the collectible is inPlay. If inPlay cant put it on Sale
    require(checkIsAttached(_tokenIds[ii]) == 0);

    // approve token to for Sale creation
    _approveForSale(msg.sender, address(saleManagerAddress), _tokenIds[ii]);

    saleManagerAddress.createSale(
      _tokenIds[ii],
      _startingPrices[ii],
      _endingPrices[ii],
      _durations[ii],
      msg.sender
    );
  }
}

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 MLBNFT.updateIsAttached keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_isAttached
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function updateIsAttached(uint256 _tokenId, uint256 _isAttached) internal {
  NFT memory obj = _getAttributesOfToken(_tokenId);

  obj.isAttached = _isAttached;

  allNFTs[_tokenId] = obj;
  emit AssetUpdated(_tokenId);
}

internal CollectibleBase._updatePlayerOverrideId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_newPlayerOverrideId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _updatePlayerOverrideId(uint256 _tokenId, uint256 _newPlayerOverrideId)
  internal
{
  // Get Token Obj
  NFT storage lsnftObj = allNFTs[_tokenId];
  lsnftObj.playerOverrideId = _newPlayerOverrideId;

  // Update Token Data with new updated attributes
  allNFTs[_tokenId] = lsnftObj;

  emit AssetUpdated(_tokenId);
}

internal CollectibleBase._createNFTCollectible keyboard_arrow_up

Parameters help

Name Type
_teamId
uint8 help
_attributes
uint256 help
_owner
address help
_isAttached
uint256 help
_nftData
uint256[] help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _createNFTCollectible(
  uint8 _teamId,
  uint256 _attributes,
  address _owner,
  uint256 _isAttached,
  uint256[5] _nftData
) internal returns (uint256) {
  uint256 generationSeason = (_attributes % 1000000).div(1000);
  require(generationSeasonController[generationSeason] == 1);

  uint32 _sequenceId = getSequenceId(_teamId);

  uint256 newNFTCryptoId = _createNFT(_nftData, _owner, _isAttached);

  nftTeamIdToSequenceIdToCollectible[_teamId][_sequenceId] = newNFTCryptoId;
  nftTeamIndexToCollectibleCount[_teamId] = _sequenceId;

  return newNFTCryptoId;
}

internal CollectibleBase.getSequenceId keyboard_arrow_up

Parameters help

Name Type
_teamId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function getSequenceId(uint256 _teamId) internal returns (uint32) {
  return (nftTeamIndexToCollectibleCount[_teamId] + 1);
}

internal CollectibleBase._updateGenerationSeasonFlag keyboard_arrow_up

Parameters help

Name Type
_season
uint256 help
_value
uint8 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _updateGenerationSeasonFlag(uint256 _season, uint8 _value) internal {
  generationSeasonController[_season] = _value;
}

internal CollectibleBase._updateMLBPlayerId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_newMLBPlayerId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _updateMLBPlayerId(uint256 _tokenId, uint256 _newMLBPlayerId)
  internal
{
  // Get Token Obj
  NFT storage lsnftObj = allNFTs[_tokenId];

  lsnftObj.mlbPlayerId = _newMLBPlayerId;

  // Update Token Data with new updated attributes
  allNFTs[_tokenId] = lsnftObj;

  emit AssetUpdated(_tokenId);
}

internal CollectibleBase._updateEarnedBy keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_earnedBy
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _updateEarnedBy(uint256 _tokenId, uint256 _earnedBy) internal {
  // Get Token Obj
  NFT storage lsnftObj = allNFTs[_tokenId];

  lsnftObj.earnedBy = _earnedBy;

  // Update Token Data with new updated attributes
  allNFTs[_tokenId] = lsnftObj;

  emit AssetUpdated(_tokenId);
}

internal LSNFT._createNFT keyboard_arrow_up

Parameters help

Name Type
_nftData
uint256[] help
_owner
address help
_isAttached
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _createNFT(
  uint256[5] _nftData,
  address _owner,
  uint256 _isAttached
) internal returns (uint256) {
  NFT memory _lsnftObj = NFT({
    attributes: _nftData[1],
    currentGameCardId: 0,
    mlbGameId: _nftData[2],
    playerOverrideId: _nftData[3],
    assetDetails: _nftData[0],
    isAttached: _isAttached,
    mlbPlayerId: _nftData[4],
    earnedBy: 0
  });

  uint256 newLSNFTId = allNFTs.push(_lsnftObj) - 1;

  _mint(_owner, newLSNFTId);

  // Created event
  emit Created(_owner, newLSNFTId);

  return newLSNFTId;
}

internal LSNFT._getAttributesOfToken keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _getAttributesOfToken(uint256 _tokenId) internal returns (NFT) {
  NFT storage lsnftObj = allNFTs[_tokenId];
  return lsnftObj;
}

internal LSNFT._approveForSale keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_to
address help
_tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _approveForSale(
  address _owner,
  address _to,
  uint256 _tokenId
) internal {
  address owner = ownerOf(_tokenId);
  require(_to != owner);
  require(_owner == owner || isApprovedForAll(owner, _owner));

  if (getApproved(_tokenId) != address(0) || _to != address(0)) {
    tokenApprovals[_tokenId] = _to;
    emit Approval(_owner, _to, _tokenId);
  }
}

internal ERC721Token._setTokenURIBase keyboard_arrow_up

Parameters help

Name Type
_uri
string help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setTokenURIBase(string _uri) internal {
  tokenURIBase = _uri;
}

internal ERC721Token.addTokenTo keyboard_arrow_up

Parameters help

Name Type
_to
address help
_tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function addTokenTo(address _to, uint256 _tokenId) internal {
  super.addTokenTo(_to, _tokenId);
  uint256 length = ownedTokens[_to].length;
  ownedTokens[_to].push(_tokenId);
  ownedTokensIndex[_tokenId] = length;
}

internal ERC721Token.removeTokenFrom keyboard_arrow_up

Parameters help

Name Type
_from
address help
_tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function removeTokenFrom(address _from, uint256 _tokenId) internal {
  super.removeTokenFrom(_from, _tokenId);

  // To prevent a gap in the array, we store the last token in the index of the token to delete, and
  // then delete the last slot.
  uint256 tokenIndex = ownedTokensIndex[_tokenId];
  uint256 lastTokenIndex = ownedTokens[_from].length.sub(1);
  uint256 lastToken = ownedTokens[_from][lastTokenIndex];

  ownedTokens[_from][tokenIndex] = lastToken;
  // This also deletes the contents at the last position of the array
  ownedTokens[_from].length--;

  // Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to
  // be zero. Then we can make sure that we will remove _tokenId from the ownedTokens list since we are first swapping
  // the lastToken to the first position, and then dropping the element placed in the last position of the list

  ownedTokensIndex[_tokenId] = 0;
  ownedTokensIndex[lastToken] = tokenIndex;
}

internal ERC721Token._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);

  allTokensIndex[_tokenId] = allTokens.length;
  allTokens.push(_tokenId);
}

internal ERC721Token._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);

  // Reorg all tokens array
  uint256 tokenIndex = allTokensIndex[_tokenId];
  uint256 lastTokenIndex = allTokens.length.sub(1);
  uint256 lastToken = allTokens[lastTokenIndex];

  allTokens[tokenIndex] = lastToken;
  allTokens[lastTokenIndex] = 0;

  allTokens.length--;
  allTokensIndex[_tokenId] = 0;
  allTokensIndex[lastToken] = tokenIndex;
}

internal ERC721BasicToken.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);
  // Disable solium check because of
  // https://github.com/duaraghav8/Solium/issues/175
  // solium-disable-next-line operator-whitespace
  return (_spender == owner ||
    getApproved(_tokenId) == _spender ||
    isApprovedForAll(owner, _spender));
}

internal ERC721BasicToken._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));
  addTokenTo(_to, _tokenId);
  emit Transfer(address(0), _to, _tokenId);
}

internal ERC721BasicToken._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 {
  clearApproval(_owner, _tokenId);
  removeTokenFrom(_owner, _tokenId);
  emit Transfer(_owner, address(0), _tokenId);
}

internal ERC721BasicToken.clearApproval keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function clearApproval(address _owner, uint256 _tokenId) internal {
  require(ownerOf(_tokenId) == _owner);
  if (tokenApprovals[_tokenId] != address(0)) {
    tokenApprovals[_tokenId] = address(0);
  }
}

internal ERC721BasicToken.addTokenTo keyboard_arrow_up

Parameters help

Name Type
_to
address help
_tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function addTokenTo(address _to, uint256 _tokenId) internal {
  require(tokenOwner[_tokenId] == address(0));
  tokenOwner[_tokenId] = _to;
  ownedTokensCount[_to] = ownedTokensCount[_to].add(1);
}

internal ERC721BasicToken.removeTokenFrom keyboard_arrow_up

Parameters help

Name Type
_from
address help
_tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function removeTokenFrom(address _from, uint256 _tokenId) internal {
  require(ownerOf(_tokenId) == _from);
  ownedTokensCount[_from] = ownedTokensCount[_from].sub(1);
  tokenOwner[_tokenId] = address(0);
}

internal ERC721BasicToken.checkAndCallSafeTransfer 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 checkAndCallSafeTransfer(
  address _from,
  address _to,
  uint256 _tokenId,
  bytes _data
) internal returns (bool) {
  if (!_to.isContract()) {
    return true;
  }
  bytes4 retval = ERC721Receiver(_to).onERC721Received(
    msg.sender,
    _from,
    _tokenId,
    _data
  );
  return (retval == ERC721_RECEIVED);
}