Blockwell

KnownOriginDigitalAsset

About

Stats

Public Functions 74
Event Types 12
Code Size 68,524 bytes

Library Use

Uses SafeMath for uint256.

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

EditionCreated Event

Parameters help
_editionNumber
uint256 help
_editionData
bytes32 help
_editionType
uint256 help

Minted Event

Parameters help
_tokenId
uint256 help
_editionNumber
uint256 help
_buyer
address help

OwnershipRenounced Event

Parameters help
previousOwner
address help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Pause Event

Parameters help

Purchase Event

Parameters help
_tokenId
uint256 help
_editionNumber
uint256 help
_buyer
address help
_priceInWei
uint256 help

RoleAdded Event

Parameters help
operator
address help
role
uint8 help

RoleRemoved Event

Parameters help
operator
address help
role
uint8 help

Transfer Event

Parameters help
_from
address help
_to
address help
_tokenId
uint256 help

Unpause Event

Parameters help

CommissionSplit Struct

Members
rate
uint256 help
recipient
address help

EditionDetails Struct

Members
editionNumber
uint256 help
editionData
bytes32 help
editionType
uint256 help
startDate
uint256 help
endDate
uint256 help
artistAccount
address help
artistCommission
uint256 help
priceInWei
uint256 help
tokenURI
string help
active
bool help
totalSupply
uint256 help
totalAvailable
uint256 help

MAX_UINT32 Constant

uint256 help
UNKNOWN VALUE

InterfaceId_ERC165 Constant

bytes4 help
0x01ffc9a7

ERC721_RECEIVED Constant

bytes4 help
0x150b7a02

InterfaceId_ERC721 Constant

bytes4 help
0x80ac58cd

InterfaceId_ERC721Exists Constant

bytes4 help
0x4f558e79

InterfaceId_ERC721Enumerable Constant

bytes4 help
0x780e9d63

InterfaceId_ERC721Metadata Constant

bytes4 help
0x5b5e139f

ROLE_KNOWN_ORIGIN Constant

uint8 help
1

ROLE_MINTER Constant

uint8 help
2

ROLE_UNDER_MINTER Constant

uint8 help
3

tokenBaseURI Variable

string help

highestEditionNumber Variable

uint256 help

totalPurchaseValueInWei Variable

uint256 help

totalNumberMinted Variable

uint256 help

totalNumberAvailable Variable

uint256 help

koCommissionAccount Variable

address help

owner Variable

address help

owner Variable

address help

paused Variable

bool help

editionNumberToOptionalCommissionSplit Variable

mapping(uint256 => CommissionSplit) help
Internal Variable

editionNumberToEditionDetails Variable

mapping(uint256 => EditionDetails) help
Internal Variable

tokenIdToEditionNumber Variable

mapping(uint256 => uint256) help
Internal Variable

editionNumberToTokenIds Variable

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

editionNumberToTokenIdIndex Variable

mapping(uint256 => uint256) help
Internal Variable

artistToEditionNumbers Variable

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

editionNumberToArtistIndex Variable

mapping(uint256 => uint256) help
Internal Variable

editionTypeToEditionNumber Variable

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

editionNumberToTypeIndex Variable

mapping(uint256 => uint256) 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

tokenURIs Variable

mapping(uint256 => string) help
Internal Variable

supportedInterfaces Variable

mapping(bytes4 => bool) help
Internal Variable

tokenOwner Variable

mapping(uint256 => address) help
Internal Variable

tokenApprovals Variable

mapping(uint256 => address) help
Internal Variable

ownedTokensCount Variable

mapping(address => uint256) help
Internal Variable

operatorApprovals Variable

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

roles Variable

mapping(uint8 => Roles.Role) help
Internal Variable

Functions Expand All Collapse All

renounceOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function renounceOwnership() public onlyOwner {
  emit OwnershipRenounced(owner);
  owner = address(0);
}

transferOwnership keyboard_arrow_up

Parameters help

Name Type
_newOwner
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transferOwnership(address _newOwner) public onlyOwner {
  _transferOwnership(_newOwner);
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function pause() public onlyOwner whenNotPaused {
  paused = true;
  emit Pause();
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function unpause() public onlyOwner whenPaused {
  paused = false;
  emit Unpause();
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function() external {}

reclaimEther keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function reclaimEther() external onlyOwner {
  owner.transfer(address(this).balance);
}

addAddressToAccessControl keyboard_arrow_up

Parameters help

Name Type
_operator
address help
_role
uint8 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function addAddressToAccessControl(address _operator, uint8 _role)
  public
  onlyIfKnownOrigin
{
  roles[_role].add(_operator);
  emit RoleAdded(_operator, _role);
}

removeAddressFromAccessControl keyboard_arrow_up

Parameters help

Name Type
_operator
address help
_role
uint8 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function removeAddressFromAccessControl(address _operator, uint8 _role)
  public
  onlyIfKnownOrigin
{
  roles[_role].remove(_operator);
  emit RoleRemoved(_operator, _role);
}

checkRole keyboard_arrow_up

Parameters help

Name Type
_operator
address help
_role
uint8 help

Properties

Visibility help public
Mutability help view
Source Code
function checkRole(address _operator, uint8 _role) public view {
  roles[_role].check(_operator);
}

hasRole keyboard_arrow_up

Parameters help

Name Type
_operator
address help
_role
uint8 help

Properties

Visibility help public
Mutability help view
Source Code
function hasRole(address _operator, uint8 _role) public view returns (bool) {
  return roles[_role].has(_operator);
}

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

Requirements help

null
Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _tokenId
) public {
  require(isApprovedOrOwner(msg.sender, _tokenId));
  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

Requirements help

null
null
Source Code
function safeTransferFrom(
  address _from,
  address _to,
  uint256 _tokenId
) public {
  // 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

Requirements help

null
null
Source Code
function safeTransferFrom(
  address _from,
  address _to,
  uint256 _tokenId,
  bytes _data
) public {
  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() external view returns (string) {
  return name_;
}

Parameters help

This function has no parameters.

Properties

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

tokenURI keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Modifiers help

onlyValidTokenId checks for the following:
null
Source Code
function tokenURI(uint256 _tokenId)
  public
  view
  onlyValidTokenId(_tokenId)
  returns (string)
{
  return Strings.strConcat(tokenBaseURI, tokenURIs[_tokenId]);
}

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 supportedInterfaces[_interfaceId];
}

createActiveEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_editionData
bytes32 help
_editionType
uint256 help
_startDate
uint256 help
_endDate
uint256 help
_artistAccount
address help
_artistCommission
uint256 help
_priceInWei
uint256 help
_tokenURI
string help
_totalAvailable
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function createActiveEdition(
  uint256 _editionNumber,
  bytes32 _editionData,
  uint256 _editionType,
  uint256 _startDate,
  uint256 _endDate,
  address _artistAccount,
  uint256 _artistCommission,
  uint256 _priceInWei,
  string _tokenURI,
  uint256 _totalAvailable
) public onlyIfKnownOrigin returns (bool) {
  return
    _createEdition(
      _editionNumber,
      _editionData,
      _editionType,
      _startDate,
      _endDate,
      _artistAccount,
      _artistCommission,
      _priceInWei,
      _tokenURI,
      _totalAvailable,
      true
    );
}

createInactiveEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_editionData
bytes32 help
_editionType
uint256 help
_startDate
uint256 help
_endDate
uint256 help
_artistAccount
address help
_artistCommission
uint256 help
_priceInWei
uint256 help
_tokenURI
string help
_totalAvailable
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function createInactiveEdition(
  uint256 _editionNumber,
  bytes32 _editionData,
  uint256 _editionType,
  uint256 _startDate,
  uint256 _endDate,
  address _artistAccount,
  uint256 _artistCommission,
  uint256 _priceInWei,
  string _tokenURI,
  uint256 _totalAvailable
) public onlyIfKnownOrigin returns (bool) {
  return
    _createEdition(
      _editionNumber,
      _editionData,
      _editionType,
      _startDate,
      _endDate,
      _artistAccount,
      _artistCommission,
      _priceInWei,
      _tokenURI,
      _totalAvailable,
      false
    );
}

createActivePreMintedEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_editionData
bytes32 help
_editionType
uint256 help
_startDate
uint256 help
_endDate
uint256 help
_artistAccount
address help
_artistCommission
uint256 help
_priceInWei
uint256 help
_tokenURI
string help
_totalSupply
uint256 help
_totalAvailable
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function createActivePreMintedEdition(
  uint256 _editionNumber,
  bytes32 _editionData,
  uint256 _editionType,
  uint256 _startDate,
  uint256 _endDate,
  address _artistAccount,
  uint256 _artistCommission,
  uint256 _priceInWei,
  string _tokenURI,
  uint256 _totalSupply,
  uint256 _totalAvailable
) public onlyIfKnownOrigin returns (bool) {
  _createEdition(
    _editionNumber,
    _editionData,
    _editionType,
    _startDate,
    _endDate,
    _artistAccount,
    _artistCommission,
    _priceInWei,
    _tokenURI,
    _totalAvailable,
    true
  );
  updateTotalSupply(_editionNumber, _totalSupply);
  return true;
}

createInactivePreMintedEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_editionData
bytes32 help
_editionType
uint256 help
_startDate
uint256 help
_endDate
uint256 help
_artistAccount
address help
_artistCommission
uint256 help
_priceInWei
uint256 help
_tokenURI
string help
_totalSupply
uint256 help
_totalAvailable
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function createInactivePreMintedEdition(
  uint256 _editionNumber,
  bytes32 _editionData,
  uint256 _editionType,
  uint256 _startDate,
  uint256 _endDate,
  address _artistAccount,
  uint256 _artistCommission,
  uint256 _priceInWei,
  string _tokenURI,
  uint256 _totalSupply,
  uint256 _totalAvailable
) public onlyIfKnownOrigin returns (bool) {
  _createEdition(
    _editionNumber,
    _editionData,
    _editionType,
    _startDate,
    _endDate,
    _artistAccount,
    _artistCommission,
    _priceInWei,
    _tokenURI,
    _totalAvailable,
    false
  );
  updateTotalSupply(_editionNumber, _totalSupply);
  return true;
}

purchase keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help payable
Source Code
function purchase(uint256 _editionNumber) public payable returns (uint256) {
  return purchaseTo(msg.sender, _editionNumber);
}

purchaseTo keyboard_arrow_up

Parameters help

Name Type
_to
address help
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help payable
Source Code
function purchaseTo(address _to, uint256 _editionNumber)
  public
  payable
  whenNotPaused
  onlyRealEdition(_editionNumber)
  onlyActiveEdition(_editionNumber)
  onlyAvailableEdition(_editionNumber)
  onlyPurchaseDuringWindow(_editionNumber)
  returns (uint256)
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  require(
    msg.value >= _editionDetails.priceInWei,
    "Value must be greater than price of edition"
  );

  // Construct next token ID e.g. 100000 + 1 = ID of 100001 (this first in the edition set)
  uint256 _tokenId = _nextTokenId(_editionNumber);

  // Create the token
  _mintToken(_to, _tokenId, _editionNumber, _editionDetails.tokenURI);

  // Splice funds and handle commissions
  _handleFunds(
    _editionNumber,
    _editionDetails.priceInWei,
    _editionDetails.artistAccount,
    _editionDetails.artistCommission
  );

  // Broadcast purchase
  emit Purchase(_tokenId, _editionNumber, _to, msg.value);

  return _tokenId;
}

mint keyboard_arrow_up

Parameters help

Name Type
_to
address help
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function mint(address _to, uint256 _editionNumber)
  public
  onlyIfMinter
  onlyRealEdition(_editionNumber)
  onlyAvailableEdition(_editionNumber)
  returns (uint256)
{
  // Construct next token ID e.g. 100000 + 1 = ID of 100001 (this first in the edition set)
  uint256 _tokenId = _nextTokenId(_editionNumber);

  // Create the token
  _mintToken(
    _to,
    _tokenId,
    _editionNumber,
    editionNumberToEditionDetails[_editionNumber].tokenURI
  );

  // Create the token
  return _tokenId;
}

underMint keyboard_arrow_up

Parameters help

Name Type
_to
address help
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function underMint(address _to, uint256 _editionNumber)
  public
  onlyIfUnderMinter
  onlyRealEdition(_editionNumber)
  returns (uint256)
{
  // Under mint token, meaning it takes one from the already sold version
  uint256 _tokenId = _underMintNextTokenId(_editionNumber);

  // If the next tokenId generate is more than the available number, abort as we have reached maximum under mint
  if (
    _tokenId >
    _editionNumber.add(
      editionNumberToEditionDetails[_editionNumber].totalAvailable
    )
  ) {
    revert("Reached max tokenId, cannot under mint anymore");
  }

  // Create the token
  _mintToken(
    _to,
    _tokenId,
    _editionNumber,
    editionNumberToEditionDetails[_editionNumber].tokenURI
  );

  // Create the token
  return _tokenId;
}

burn keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function burn(uint256 _tokenId) public onlyIfKnownOrigin {
  // Clear from parents
  super._burn(ownerOf(_tokenId), _tokenId);

  // Get hold of the edition for cleanup
  uint256 _editionNumber = tokenIdToEditionNumber[_tokenId];

  // Delete token ID mapping
  delete tokenIdToEditionNumber[_tokenId];

  // Delete tokens associated to the edition - this will leave a gap in the array of zero
  uint256[] storage tokenIdsForEdition = editionNumberToTokenIds[
    _editionNumber
  ];
  uint256 editionTokenIdIndex = editionNumberToTokenIdIndex[_tokenId];
  delete tokenIdsForEdition[editionTokenIdIndex];
}

batchTransfer keyboard_arrow_up

Parameters help

Name Type
_to
address help
_tokenIds
uint256[] help

Properties

Visibility help public
Mutability help transaction
Source Code
function batchTransfer(address _to, uint256[] _tokenIds) public {
  for (uint256 i = 0; i < _tokenIds.length; i++) {
    safeTransferFrom(ownerOf(_tokenIds[i]), _to, _tokenIds[i]);
  }
}

batchTransferFrom keyboard_arrow_up

Parameters help

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

Properties

Visibility help public
Mutability help transaction
Source Code
function batchTransferFrom(
  address _from,
  address _to,
  uint256[] _tokenIds
) public {
  for (uint256 i = 0; i < _tokenIds.length; i++) {
    transferFrom(_from, _to, _tokenIds[i]);
  }
}

updateTokenBaseURI keyboard_arrow_up

Parameters help

Name Type
_newBaseURI
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function updateTokenBaseURI(string _newBaseURI) external onlyIfKnownOrigin {
  require(bytes(_newBaseURI).length != 0, "Base URI invalid");
  tokenBaseURI = _newBaseURI;
}

updateKoCommissionAccount keyboard_arrow_up

Parameters help

Name Type
_koCommissionAccount
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function updateKoCommissionAccount(address _koCommissionAccount)
  external
  onlyIfKnownOrigin
{
  require(_koCommissionAccount != address(0), "Invalid address");
  koCommissionAccount = _koCommissionAccount;
}

updateEditionTokenURI keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_uri
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateEditionTokenURI(uint256 _editionNumber, string _uri)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{
  editionNumberToEditionDetails[_editionNumber].tokenURI = _uri;
}

updatePriceInWei keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_priceInWei
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updatePriceInWei(uint256 _editionNumber, uint256 _priceInWei)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{
  editionNumberToEditionDetails[_editionNumber].priceInWei = _priceInWei;
}

updateArtistCommission keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_rate
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateArtistCommission(uint256 _editionNumber, uint256 _rate)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{
  editionNumberToEditionDetails[_editionNumber].artistCommission = _rate;
}

updateArtistsAccount keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_artistAccount
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateArtistsAccount(uint256 _editionNumber, address _artistAccount)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{

    EditionDetails storage _originalEditionDetails
   = editionNumberToEditionDetails[_editionNumber];

  uint256 editionArtistIndex = editionNumberToArtistIndex[_editionNumber];

  // Get list of editions old artist works with
  uint256[] storage editionNumbersForArtist = artistToEditionNumbers[
    _originalEditionDetails.artistAccount
  ];

  // Remove edition from artists lists
  delete editionNumbersForArtist[editionArtistIndex];

  // Add new artists to the list
  uint256 newArtistsEditionIndex = artistToEditionNumbers[_artistAccount]
  .length;
  artistToEditionNumbers[_artistAccount].push(_editionNumber);
  editionNumberToArtistIndex[_editionNumber] = newArtistsEditionIndex;

  // Update the edition
  _originalEditionDetails.artistAccount = _artistAccount;
}

updateEditionType keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_editionType
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateEditionType(uint256 _editionNumber, uint256 _editionType)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{

    EditionDetails storage _originalEditionDetails
   = editionNumberToEditionDetails[_editionNumber];

  // Get list of editions for old type
  uint256[] storage editionNumbersForType = editionTypeToEditionNumber[
    _originalEditionDetails.editionType
  ];

  // Remove edition from old type list
  uint256 editionTypeIndex = editionNumberToTypeIndex[_editionNumber];
  delete editionNumbersForType[editionTypeIndex];

  // Add new type to the list
  uint256 newTypeEditionIndex = editionTypeToEditionNumber[_editionType].length;
  editionTypeToEditionNumber[_editionType].push(_editionNumber);
  editionNumberToTypeIndex[_editionNumber] = newTypeEditionIndex;

  // Update the edition
  _originalEditionDetails.editionType = _editionType;
}

updateActive keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_active
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateActive(uint256 _editionNumber, bool _active)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{
  editionNumberToEditionDetails[_editionNumber].active = _active;
}

updateTotalSupply keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_totalSupply
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateTotalSupply(uint256 _editionNumber, uint256 _totalSupply)
  public
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{
  require(
    tokensOfEdition(_editionNumber).length <= _totalSupply,
    "Can not lower totalSupply to below the number of tokens already in existence"
  );
  editionNumberToEditionDetails[_editionNumber].totalSupply = _totalSupply;
}

updateTotalAvailable keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_totalAvailable
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function updateTotalAvailable(uint256 _editionNumber, uint256 _totalAvailable)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];

  require(
    _editionDetails.totalSupply <= _totalAvailable,
    "Unable to reduce available amount to the below the number totalSupply"
  );

  uint256 originalAvailability = _editionDetails.totalAvailable;
  _editionDetails.totalAvailable = _totalAvailable;
  totalNumberAvailable = totalNumberAvailable.sub(originalAvailability).add(
    _totalAvailable
  );
}

updateStartDate keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_startDate
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateStartDate(uint256 _editionNumber, uint256 _startDate)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{
  editionNumberToEditionDetails[_editionNumber].startDate = _startDate;
}

updateEndDate keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_endDate
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateEndDate(uint256 _editionNumber, uint256 _endDate)
  external
  onlyIfKnownOrigin
  onlyRealEdition(_editionNumber)
{
  editionNumberToEditionDetails[_editionNumber].endDate = _endDate;
}

updateOptionalCommission keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_rate
uint256 help
_recipient
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

UNKNOWN VALUE must be less than or equal to 100
Source Code
function updateOptionalCommission(
  uint256 _editionNumber,
  uint256 _rate,
  address _recipient
) external onlyIfKnownOrigin onlyRealEdition(_editionNumber) {
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  uint256 artistCommission = _editionDetails.artistCommission;

  if (_rate > 0) {
    require(
      _recipient != address(0),
      "Setting a rate must be accompanied by a valid address"
    );
  }
  require(
    artistCommission.add(_rate) <= 100,
    "Cant set commission greater than 100%"
  );

  editionNumberToOptionalCommissionSplit[_editionNumber] = CommissionSplit({
    rate: _rate,
    recipient: _recipient
  });
}

setTokenURI keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_uri
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

null
Source Code
function setTokenURI(uint256 _tokenId, string _uri)
  external
  onlyIfKnownOrigin
  onlyValidTokenId(_tokenId)
{
  _setTokenURI(_tokenId, _uri);
}

editionOfTokenId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function editionOfTokenId(uint256 _tokenId)
  public
  view
  returns (uint256 _editionNumber)
{
  return tokenIdToEditionNumber[_tokenId];
}

editionsOfType keyboard_arrow_up

Parameters help

Name Type
_type
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function editionsOfType(uint256 _type)
  public
  view
  returns (uint256[] _editionNumbers)
{
  return editionTypeToEditionNumber[_type];
}

artistsEditions keyboard_arrow_up

Parameters help

Name Type
_artistsAccount
address help

Properties

Visibility help public
Mutability help view
Source Code
function artistsEditions(address _artistsAccount)
  public
  view
  returns (uint256[] _editionNumbers)
{
  return artistToEditionNumbers[_artistsAccount];
}

tokensOfEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function tokensOfEdition(uint256 _editionNumber)
  public
  view
  returns (uint256[] _tokenIds)
{
  return editionNumberToTokenIds[_editionNumber];
}

tokensOf keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help view
Source Code
function tokensOf(address _owner) public view returns (uint256[] _tokenIds) {
  return ownedTokens[_owner];
}

editionExists keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function editionExists(uint256 _editionNumber) public view returns (bool) {
  if (_editionNumber == 0) {
    return false;
  }
  EditionDetails storage editionNumber = editionNumberToEditionDetails[
    _editionNumber
  ];
  return editionNumber.editionNumber == _editionNumber;
}

editionOptionalCommission keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function editionOptionalCommission(uint256 _editionNumber)
  public
  view
  returns (uint256 _rate, address _recipient)
{
  CommissionSplit storage commission = editionNumberToOptionalCommissionSplit[
    _editionNumber
  ];
  return (commission.rate, commission.recipient);
}

detailsOfEdition keyboard_arrow_up

Parameters help

Name Type
editionNumber
uint256 help

Properties

Visibility help public
Mutability help view

Modifiers help

Source Code
function detailsOfEdition(uint256 editionNumber)
  public
  view
  onlyRealEdition(editionNumber)
  returns (
    bytes32 _editionData,
    uint256 _editionType,
    uint256 _startDate,
    uint256 _endDate,
    address _artistAccount,
    uint256 _artistCommission,
    uint256 _priceInWei,
    string _tokenURI,
    uint256 _totalSupply,
    uint256 _totalAvailable,
    bool _active
  )
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    editionNumber
  ];
  return (
    _editionDetails.editionData,
    _editionDetails.editionType,
    _editionDetails.startDate,
    _editionDetails.endDate,
    _editionDetails.artistAccount,
    _editionDetails.artistCommission,
    _editionDetails.priceInWei,
    Strings.strConcat(tokenBaseURI, _editionDetails.tokenURI),
    _editionDetails.totalSupply,
    _editionDetails.totalAvailable,
    _editionDetails.active
  );
}

tokenData keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Modifiers help

onlyValidTokenId checks for the following:
null
Source Code
function tokenData(uint256 _tokenId)
  public
  view
  onlyValidTokenId(_tokenId)
  returns (
    uint256 _editionNumber,
    uint256 _editionType,
    bytes32 _editionData,
    string _tokenURI,
    address _owner
  )
{
  uint256 editionNumber = tokenIdToEditionNumber[_tokenId];
  EditionDetails storage editionDetails = editionNumberToEditionDetails[
    editionNumber
  ];
  return (
    editionNumber,
    editionDetails.editionType,
    editionDetails.editionData,
    tokenURI(_tokenId),
    ownerOf(_tokenId)
  );
}

tokenURISafe keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function tokenURISafe(uint256 _tokenId) public view returns (string) {
  return Strings.strConcat(tokenBaseURI, tokenURIs[_tokenId]);
}

purchaseDatesToken keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function purchaseDatesToken(uint256 _tokenId)
  public
  view
  returns (uint256 _startDate, uint256 _endDate)
{
  uint256 _editionNumber = tokenIdToEditionNumber[_tokenId];
  return purchaseDatesEdition(_editionNumber);
}

priceInWeiToken keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function priceInWeiToken(uint256 _tokenId)
  public
  view
  returns (uint256 _priceInWei)
{
  uint256 _editionNumber = tokenIdToEditionNumber[_tokenId];
  return priceInWeiEdition(_editionNumber);
}

editionData keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function editionData(uint256 _editionNumber) public view returns (bytes32) {
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return _editionDetails.editionData;
}

editionType keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function editionType(uint256 _editionNumber) public view returns (uint256) {
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return _editionDetails.editionType;
}

purchaseDatesEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function purchaseDatesEdition(uint256 _editionNumber)
  public
  view
  returns (uint256 _startDate, uint256 _endDate)
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return (_editionDetails.startDate, _editionDetails.endDate);
}

artistCommission keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function artistCommission(uint256 _editionNumber)
  public
  view
  returns (address _artistAccount, uint256 _artistCommission)
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return (_editionDetails.artistAccount, _editionDetails.artistCommission);
}

priceInWeiEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function priceInWeiEdition(uint256 _editionNumber)
  public
  view
  returns (uint256 _priceInWei)
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return _editionDetails.priceInWei;
}

tokenURIEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function tokenURIEdition(uint256 _editionNumber) public view returns (string) {
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return Strings.strConcat(tokenBaseURI, _editionDetails.tokenURI);
}

editionActive keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function editionActive(uint256 _editionNumber) public view returns (bool) {
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return _editionDetails.active;
}

totalRemaining keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function totalRemaining(uint256 _editionNumber) public view returns (uint256) {
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return _editionDetails.totalAvailable.sub(_editionDetails.totalSupply);
}

totalAvailableEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function totalAvailableEdition(uint256 _editionNumber)
  public
  view
  returns (uint256)
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return _editionDetails.totalAvailable;
}

totalSupplyEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function totalSupplyEdition(uint256 _editionNumber)
  public
  view
  returns (uint256)
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];
  return _editionDetails.totalSupply;
}

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 KnownOriginDigitalAssetV2._createEdition keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_editionData
bytes32 help
_editionType
uint256 help
_startDate
uint256 help
_endDate
uint256 help
_artistAccount
address help
_artistCommission
uint256 help
_priceInWei
uint256 help
_tokenURI
string help
_totalAvailable
uint256 help
_active
bool help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _createEdition(
  uint256 _editionNumber,
  bytes32 _editionData,
  uint256 _editionType,
  uint256 _startDate,
  uint256 _endDate,
  address _artistAccount,
  uint256 _artistCommission,
  uint256 _priceInWei,
  string _tokenURI,
  uint256 _totalAvailable,
  bool _active
) internal returns (bool) {
  // Prevent missing edition number
  require(_editionNumber != 0, "Edition number not provided");

  // Prevent edition number lower than last one used
  require(
    _editionNumber > highestEditionNumber,
    "Edition number must be greater than previously used"
  );

  // Check previously edition plus total available is less than new edition number
  require(
    highestEditionNumber.add(
      editionNumberToEditionDetails[highestEditionNumber].totalAvailable
    ) < _editionNumber,
    "Edition number must be greater than previously used plus total available"
  );

  // Prevent missing types
  require(_editionType != 0, "Edition type not provided");

  // Prevent missing token URI
  require(bytes(_tokenURI).length != 0, "Token URI is missing");

  // Prevent empty artists address
  require(_artistAccount != address(0), "Artist account not provided");

  // Prevent invalid commissions
  require(
    _artistCommission <= 100 && _artistCommission >= 0,
    "Artist commission cannot be greater than 100 or less than 0"
  );

  // Prevent duplicate editions
  require(
    editionNumberToEditionDetails[_editionNumber].editionNumber == 0,
    "Edition already in existence"
  );

  // Default end date to max uint256
  uint256 endDate = _endDate;
  if (_endDate == 0) {
    endDate = MAX_UINT32;
  }

  editionNumberToEditionDetails[_editionNumber] = EditionDetails({
    editionNumber: _editionNumber,
    editionData: _editionData,
    editionType: _editionType,
    startDate: _startDate,
    endDate: endDate,
    artistAccount: _artistAccount,
    artistCommission: _artistCommission,
    priceInWei: _priceInWei,
    tokenURI: _tokenURI,
    totalSupply: 0, // default to all available
    totalAvailable: _totalAvailable,
    active: _active
  });

  // Add to total available count
  totalNumberAvailable = totalNumberAvailable.add(_totalAvailable);

  // Update mappings
  _updateArtistLookupData(_artistAccount, _editionNumber);
  _updateEditionTypeLookupData(_editionType, _editionNumber);

  emit EditionCreated(_editionNumber, _editionData, _editionType);

  // Update the edition pointer if needs be
  highestEditionNumber = _editionNumber;

  return true;
}

internal KnownOriginDigitalAssetV2._updateEditionTypeLookupData keyboard_arrow_up

Parameters help

Name Type
_editionType
uint256 help
_editionNumber
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _updateEditionTypeLookupData(
  uint256 _editionType,
  uint256 _editionNumber
) internal {
  uint256 typeEditionIndex = editionTypeToEditionNumber[_editionType].length;
  editionTypeToEditionNumber[_editionType].push(_editionNumber);
  editionNumberToTypeIndex[_editionNumber] = typeEditionIndex;
}

internal KnownOriginDigitalAssetV2._updateArtistLookupData keyboard_arrow_up

Parameters help

Name Type
_artistAccount
address help
_editionNumber
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _updateArtistLookupData(address _artistAccount, uint256 _editionNumber)
  internal
{
  uint256 artistEditionIndex = artistToEditionNumbers[_artistAccount].length;
  artistToEditionNumbers[_artistAccount].push(_editionNumber);
  editionNumberToArtistIndex[_editionNumber] = artistEditionIndex;
}

internal KnownOriginDigitalAssetV2._nextTokenId keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _nextTokenId(uint256 _editionNumber) internal returns (uint256) {
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];

  // Bump number totalSupply
  _editionDetails.totalSupply = _editionDetails.totalSupply.add(1);

  // Construct next token ID e.g. 100000 + 1 = ID of 100001 (this first in the edition set)
  return _editionDetails.editionNumber.add(_editionDetails.totalSupply);
}

internal KnownOriginDigitalAssetV2._underMintNextTokenId keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _underMintNextTokenId(uint256 _editionNumber)
  internal
  returns (uint256)
{
  EditionDetails storage _editionDetails = editionNumberToEditionDetails[
    _editionNumber
  ];

  // For old editions start the counter as edition + 1
  uint256 _tokenId = _editionDetails.editionNumber.add(1);

  // Work your way up until you find a free token based on the new _tokenIdd
  while (exists(_tokenId)) {
    _tokenId = _tokenId.add(1);
  }

  // Bump number totalSupply if we are now over minting new tokens
  if (
    _tokenId > _editionDetails.editionNumber.add(_editionDetails.totalSupply)
  ) {
    _editionDetails.totalSupply = _editionDetails.totalSupply.add(1);
  }

  return _tokenId;
}

internal KnownOriginDigitalAssetV2._mintToken keyboard_arrow_up

Parameters help

Name Type
_to
address help
_tokenId
uint256 help
_editionNumber
uint256 help
_tokenURI
string help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _mintToken(
  address _to,
  uint256 _tokenId,
  uint256 _editionNumber,
  string _tokenURI
) internal {
  // Mint new base token
  super._mint(_to, _tokenId);
  super._setTokenURI(_tokenId, _tokenURI);

  // Maintain mapping for tokenId to edition for lookup
  tokenIdToEditionNumber[_tokenId] = _editionNumber;

  // Get next insert position for edition to token Id mapping
  uint256 currentIndexOfTokenId = editionNumberToTokenIds[_editionNumber]
  .length;

  // Maintain mapping of edition to token array for "edition minted tokens"
  editionNumberToTokenIds[_editionNumber].push(_tokenId);

  // Maintain a position index for the tokenId within the edition number mapping array, used for clean up token burn
  editionNumberToTokenIdIndex[_tokenId] = currentIndexOfTokenId;

  // Record sale volume
  totalNumberMinted = totalNumberMinted.add(1);

  // Emit minted event
  emit Minted(_tokenId, _editionNumber, _to);
}

internal KnownOriginDigitalAssetV2._handleFunds keyboard_arrow_up

Parameters help

Name Type
_editionNumber
uint256 help
_priceInWei
uint256 help
_artistAccount
address help
_artistCommission
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _handleFunds(
  uint256 _editionNumber,
  uint256 _priceInWei,
  address _artistAccount,
  uint256 _artistCommission
) internal {
  // Extract the artists commission and send it
  uint256 artistPayment = _priceInWei.div(100).mul(_artistCommission);
  if (artistPayment > 0) {
    _artistAccount.transfer(artistPayment);
  }

  // Load any commission overrides
  CommissionSplit storage commission = editionNumberToOptionalCommissionSplit[
    _editionNumber
  ];

  // Apply optional commission structure
  if (commission.rate > 0) {
    uint256 rateSplit = _priceInWei.div(100).mul(commission.rate);
    commission.recipient.transfer(rateSplit);
  }

  // Send remaining eth to KO
  uint256 remainingCommission = msg.value.sub(artistPayment).sub(rateSplit);
  koCommissionAccount.transfer(remainingCommission);

  // Record wei sale value
  totalPurchaseValueInWei = totalPurchaseValueInWei.add(msg.value);
}

internal ERC721Token._setTokenURI keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_uri
string help

Properties

Visibility help internal
Mutability help transaction

Requirements help

null
Source Code
function _setTokenURI(uint256 _tokenId, string _uri) internal {
  require(exists(_tokenId));
  tokenURIs[_tokenId] = _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);

  // Clear metadata (if any)
  if (bytes(tokenURIs[_tokenId]).length != 0) {
    delete tokenURIs[_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 SupportsInterfaceWithLookup._registerInterface keyboard_arrow_up

Parameters help

Name Type
_interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _registerInterface(bytes4 _interfaceId) internal {
  require(_interfaceId != 0xffffffff);
  supportedInterfaces[_interfaceId] = true;
}

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

internal SupportsInterfaceWithLookup._registerInterface keyboard_arrow_up

Parameters help

Name Type
_interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _registerInterface(bytes4 _interfaceId) internal {
  require(_interfaceId != 0xffffffff);
  supportedInterfaces[_interfaceId] = true;
}

internal Ownable._transferOwnership keyboard_arrow_up

Parameters help

Name Type
_newOwner
address help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _transferOwnership(address _newOwner) internal {
  require(_newOwner != address(0));
  emit OwnershipTransferred(owner, _newOwner);
  owner = _newOwner;
}

internal Ownable._transferOwnership keyboard_arrow_up

Parameters help

Name Type
_newOwner
address help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _transferOwnership(address _newOwner) internal {
  require(_newOwner != address(0));
  emit OwnershipTransferred(owner, _newOwner);
  owner = _newOwner;
}