Blockwell

Art Blocks

About

Stats

Public Functions 57
Event Types 4
Code Size 48,356 bytes

Library Use

Uses SafeMath for uint256.

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

Mint Event

Parameters help
_to
address help
_tokenId
uint256 help
_projectId
uint256 help
_invocations
uint256 help
_value
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

Project Struct

Members
name
string help
artist
string help
description
string help
website
string help
license
string help
dynamic
bool help
artistAddress
address help
additionalPayee
address help
additionalPayeePercentage
uint256 help
secondMarketRoyalty
uint256 help
pricePerTokenInWei
uint256 help
projectBaseURI
string help
projectBaseIpfsURI
string help
invocations
uint256 help
maxInvocations
uint256 help
scriptJSON
string help
scripts
mapping(uint256 => string) help
scriptCount
uint help
ipfsHash
string help
hashes
uint256 help
useIpfs
bool help
active
bool help
locked
bool help
paused
bool help

ONE_MILLION Constant

uint256 help
1_000_000

_INTERFACE_ID_ERC721_METADATA Constant

bytes4 help
0x5b5e139f

_INTERFACE_ID_ERC165 Constant

bytes4 help
0x01ffc9a7

_ERC721_RECEIVED Constant

bytes4 help
0x150b7a02

_INTERFACE_ID_ERC721 Constant

bytes4 help
0x80ac58cd

_INTERFACE_ID_ERC721_ENUMERABLE Constant

bytes4 help
0x780e9d63

artblocksAddress Variable

address help

artblocksPercentage Variable

uint256 help

admin Variable

address help

nextProjectId Variable

uint256 help

tokenIdToProjectId Variable

mapping(uint256 => uint256) help

hashToTokenId Variable

mapping(bytes32 => uint256) help

isWhitelisted Variable

mapping(address => bool) help

projects Variable

mapping(uint256 => Project) help
Internal Variable

projectIdToTokenIds Variable

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

tokenIdToHashes Variable

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

_name Variable

string help
Internal Variable

_symbol Variable

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 => Counters.Counter) help
Internal Variable

_operatorApprovals Variable

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

_ownedTokens Variable

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

_ownedTokensIndex Variable

mapping(uint256 => uint256) help
Internal Variable

_allTokens Variable

uint256[] help
Internal Variable

_allTokensIndex Variable

mapping(uint256 => uint256) help
Internal Variable

Functions Expand All Collapse All

Parameters help

Name Type
owner
address help

Properties

Visibility help public
Mutability help view

Requirements help

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

  return _ownedTokensCount[owner].current();
}

ownerOf keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function ownerOf(uint256 tokenId) public view returns (address) {
  address owner = _tokenOwner[tokenId];
  require(owner != address(0), "ERC721: owner query for nonexistent token");

  return owner;
}

safeTransferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

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

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

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

  _transferFrom(from, to, tokenId);
}

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

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

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

  _tokenApprovals[tokenId] = to;
  emit Approval(owner, to, tokenId);
}

getApproved keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

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

  return _tokenApprovals[tokenId];
}

setApprovalForAll keyboard_arrow_up

Parameters help

Name Type
to
address help
approved
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function setApprovalForAll(address to, bool approved) public {
  require(to != msg.sender, "ERC721: approve to caller");

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

safeTransferFrom keyboard_arrow_up

Parameters help

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

Properties

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

Parameters help

This function has no parameters.

Properties

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

tokenOfOwnerByIndex keyboard_arrow_up

Parameters help

Name Type
owner
address help
index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function tokenOfOwnerByIndex(address owner, uint256 index)
  public
  view
  returns (uint256)
{
  require(
    index < balanceOf(owner),
    "ERC721Enumerable: owner index out of bounds"
  );
  return _ownedTokens[owner][index];
}

tokenByIndex keyboard_arrow_up

Parameters help

Name Type
index
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function tokenByIndex(uint256 index) public view returns (uint256) {
  require(
    index < totalSupply(),
    "ERC721Enumerable: global index out of bounds"
  );
  return _allTokens[index];
}

supportsInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

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

Parameters help

This function has no parameters.

Properties

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

Parameters help

This function has no parameters.

Properties

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

purchase keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

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

purchaseTo keyboard_arrow_up

Parameters help

Name Type
_to
address help
_projectId
uint256 help

Properties

Visibility help public
Mutability help payable
Source Code
function purchaseTo(address _to, uint256 _projectId)
  public
  payable
  returns (uint256 _tokenId)
{
  require(
    msg.value >= projects[_projectId].pricePerTokenInWei,
    "Must send at least pricePerTokenInWei"
  );
  require(
    projects[_projectId].invocations.add(1) <=
      projects[_projectId].maxInvocations,
    "Must not exceed max invocations"
  );
  require(
    projects[_projectId].active ||
      msg.sender == projects[_projectId].artistAddress,
    "Project must exist and be active"
  );
  require(
    !projects[_projectId].paused ||
      msg.sender == projects[_projectId].artistAddress,
    "Purchases are paused."
  );

  uint256 tokenId = _mintToken(_to, _projectId);

  _splitFunds(_projectId);

  return tokenId;
}

updateArtblocksAddress keyboard_arrow_up

Parameters help

Name Type
_artblocksAddress
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateArtblocksAddress(address payable _artblocksAddress)
  public
  onlyAdmin
{
  artblocksAddress = _artblocksAddress;
}

updateArtblocksPercentage keyboard_arrow_up

Parameters help

Name Type
_artblocksPercentage
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function updateArtblocksPercentage(uint256 _artblocksPercentage)
  public
  onlyAdmin
{
  require(_artblocksPercentage <= 25, "Max of 25%");
  artblocksPercentage = _artblocksPercentage;
}

addWhitelisted keyboard_arrow_up

Parameters help

Name Type
_address
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function addWhitelisted(address _address) public onlyAdmin {
  isWhitelisted[_address] = true;
}

removeWhitelisted keyboard_arrow_up

Parameters help

Name Type
_address
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function removeWhitelisted(address _address) public onlyAdmin {
  isWhitelisted[_address] = false;
}

toggleProjectIsLocked keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyWhitelisted checks for the following:
Source Code
function toggleProjectIsLocked(uint256 _projectId)
  public
  onlyWhitelisted
  onlyUnlocked(_projectId)
{
  projects[_projectId].locked = true;
}

toggleProjectIsActive keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyWhitelisted checks for the following:
Source Code
function toggleProjectIsActive(uint256 _projectId) public onlyWhitelisted {
  projects[_projectId].active = !projects[_projectId].active;
}

updateProjectArtistAddress keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_artistAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateProjectArtistAddress(
  uint256 _projectId,
  address payable _artistAddress
) public onlyArtistOrWhitelisted(_projectId) {
  projects[_projectId].artistAddress = _artistAddress;
}

toggleProjectIsPaused keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function toggleProjectIsPaused(uint256 _projectId)
  public
  onlyArtist(_projectId)
{
  projects[_projectId].paused = !projects[_projectId].paused;
}

addProject keyboard_arrow_up

Parameters help

Name Type
_pricePerTokenInWei
uint256 help
_dynamic
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyWhitelisted checks for the following:
Source Code
function addProject(uint256 _pricePerTokenInWei, bool _dynamic)
  public
  onlyWhitelisted
{
  uint256 projectId = nextProjectId;
  projects[projectId].artistAddress = msg.sender;
  projects[projectId].pricePerTokenInWei = _pricePerTokenInWei;
  projects[projectId].paused = true;
  projects[projectId].dynamic = _dynamic;
  projects[projectId].maxInvocations = ONE_MILLION;
  if (!_dynamic) {
    projects[projectId].hashes = 0;
  } else {
    projects[projectId].hashes = 1;
  }
  nextProjectId = nextProjectId.add(1);
}

updateProjectPricePerTokenInWei keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_pricePerTokenInWei
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateProjectPricePerTokenInWei(
  uint256 _projectId,
  uint256 _pricePerTokenInWei
) public onlyArtist(_projectId) {
  projects[_projectId].pricePerTokenInWei = _pricePerTokenInWei;
}

updateProjectName keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_projectName
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateProjectName(uint256 _projectId, string memory _projectName)
  public
  onlyUnlocked(_projectId)
  onlyArtistOrWhitelisted(_projectId)
{
  projects[_projectId].name = _projectName;
}

updateProjectArtistName keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_projectArtistName
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateProjectArtistName(
  uint256 _projectId,
  string memory _projectArtistName
) public onlyUnlocked(_projectId) onlyArtistOrWhitelisted(_projectId) {
  projects[_projectId].artist = _projectArtistName;
}

updateProjectAdditionalPayeeInfo keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_additionalPayee
address help
_additionalPayeePercentage
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function updateProjectAdditionalPayeeInfo(
  uint256 _projectId,
  address payable _additionalPayee,
  uint256 _additionalPayeePercentage
) public onlyArtist(_projectId) {
  require(_additionalPayeePercentage <= 100, "Max of 100%");
  projects[_projectId].additionalPayee = _additionalPayee;
  projects[_projectId].additionalPayeePercentage = _additionalPayeePercentage;
}

updateProjectSecondaryMarketRoyaltyPercentage keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_secondMarketRoyalty
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function updateProjectSecondaryMarketRoyaltyPercentage(
  uint256 _projectId,
  uint256 _secondMarketRoyalty
) public onlyArtist(_projectId) {
  require(_secondMarketRoyalty <= 100, "Max of 100%");
  projects[_projectId].secondMarketRoyalty = _secondMarketRoyalty;
}

updateProjectDescription keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_projectDescription
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateProjectDescription(
  uint256 _projectId,
  string memory _projectDescription
) public onlyArtist(_projectId) {
  projects[_projectId].description = _projectDescription;
}

updateProjectWebsite keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_projectWebsite
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateProjectWebsite(uint256 _projectId, string memory _projectWebsite)
  public
  onlyArtist(_projectId)
{
  projects[_projectId].website = _projectWebsite;
}

updateProjectLicense keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_projectLicense
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateProjectLicense(uint256 _projectId, string memory _projectLicense)
  public
  onlyUnlocked(_projectId)
  onlyArtistOrWhitelisted(_projectId)
{
  projects[_projectId].license = _projectLicense;
}

updateProjectMaxInvocations keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_maxInvocations
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateProjectMaxInvocations(
  uint256 _projectId,
  uint256 _maxInvocations
) public onlyUnlocked(_projectId) onlyArtistOrWhitelisted(_projectId) {
  require(
    _maxInvocations > projects[_projectId].invocations,
    "You must set max invocations greater than current invocations"
  );
  require(_maxInvocations <= ONE_MILLION, "Cannot exceed 1,000,000");
  projects[_projectId].maxInvocations = _maxInvocations;
}

updateProjectHashesGenerated keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_hashes
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyWhitelisted checks for the following:
Source Code
function updateProjectHashesGenerated(uint256 _projectId, uint256 _hashes)
  public
  onlyUnlocked(_projectId)
  onlyWhitelisted()
{
  require(
    projects[_projectId].invocations == 0,
    "Can not modify hashes generated after a token is minted."
  );
  require(
    projects[_projectId].dynamic,
    "Can only modify hashes on dynamic projects."
  );
  require(
    _hashes <= 100 && _hashes >= 0,
    "Hashes generated must be a positive integer and max hashes per invocation are 100"
  );
  projects[_projectId].hashes = _hashes;
}

addProjectScript keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_script
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function addProjectScript(uint256 _projectId, string memory _script)
  public
  onlyUnlocked(_projectId)
  onlyArtistOrWhitelisted(_projectId)
{
  projects[_projectId].scripts[projects[_projectId].scriptCount] = _script;
  projects[_projectId].scriptCount = projects[_projectId].scriptCount.add(1);
}

updateProjectScript keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_scriptId
uint256 help
_script
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function updateProjectScript(
  uint256 _projectId,
  uint256 _scriptId,
  string memory _script
) public onlyUnlocked(_projectId) onlyArtistOrWhitelisted(_projectId) {
  require(
    _scriptId < projects[_projectId].scriptCount,
    "scriptId out of range"
  );
  projects[_projectId].scripts[_scriptId] = _script;
}

removeProjectLastScript keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function removeProjectLastScript(uint256 _projectId)
  public
  onlyUnlocked(_projectId)
  onlyArtistOrWhitelisted(_projectId)
{
  require(
    projects[_projectId].scriptCount > 0,
    "there are no scripts to remove"
  );
  delete projects[_projectId].scripts[projects[_projectId].scriptCount - 1];
  projects[_projectId].scriptCount = projects[_projectId].scriptCount.sub(1);
}

updateProjectScriptJSON keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_projectScriptJSON
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateProjectScriptJSON(
  uint256 _projectId,
  string memory _projectScriptJSON
) public onlyUnlocked(_projectId) onlyArtistOrWhitelisted(_projectId) {
  projects[_projectId].scriptJSON = _projectScriptJSON;
}

updateProjectIpfsHash keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_ipfsHash
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function updateProjectIpfsHash(uint256 _projectId, string memory _ipfsHash)
  public
  onlyUnlocked(_projectId)
  onlyArtistOrWhitelisted(_projectId)
{
  projects[_projectId].ipfsHash = _ipfsHash;
}

updateProjectBaseURI keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_newBaseURI
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateProjectBaseURI(uint256 _projectId, string memory _newBaseURI)
  public
  onlyArtist(_projectId)
{
  projects[_projectId].projectBaseURI = _newBaseURI;
}

updateProjectBaseIpfsURI keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_projectBaseIpfsURI
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateProjectBaseIpfsURI(
  uint256 _projectId,
  string memory _projectBaseIpfsURI
) public onlyArtist(_projectId) {
  projects[_projectId].projectBaseIpfsURI = _projectBaseIpfsURI;
}

toggleProjectUseIpfsForStatic keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function toggleProjectUseIpfsForStatic(uint256 _projectId)
  public
  onlyArtist(_projectId)
{
  require(
    !projects[_projectId].dynamic,
    "can only set static IPFS hash for static projects"
  );
  projects[_projectId].useIpfs = !projects[_projectId].useIpfs;
}

toggleProjectIsDynamic keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function toggleProjectIsDynamic(uint256 _projectId)
  public
  onlyUnlocked(_projectId)
  onlyArtistOrWhitelisted(_projectId)
{
  require(
    projects[_projectId].invocations == 0,
    "Can not switch after a token is minted."
  );
  if (projects[_projectId].dynamic) {
    projects[_projectId].hashes = 0;
  } else {
    projects[_projectId].hashes = 1;
  }
  projects[_projectId].dynamic = !projects[_projectId].dynamic;
}

overrideTokenDynamicImageWithIpfsLink keyboard_arrow_up

clearTokenIpfsImageUri keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function clearTokenIpfsImageUri(uint256 _tokenId)
  public
  onlyArtist(tokenIdToProjectId[_tokenId])
{
  delete staticIpfsImageLink[tokenIdToProjectId[_tokenId]];
}

projectDetails keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function projectDetails(uint256 _projectId)
  public
  view
  returns (
    string memory projectName,
    string memory artist,
    string memory description,
    string memory website,
    string memory license,
    bool dynamic
  )
{
  projectName = projects[_projectId].name;
  artist = projects[_projectId].artist;
  description = projects[_projectId].description;
  website = projects[_projectId].website;
  license = projects[_projectId].license;
  dynamic = projects[_projectId].dynamic;
}

projectTokenInfo keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function projectTokenInfo(uint256 _projectId)
  public
  view
  returns (
    address artistAddress,
    uint256 pricePerTokenInWei,
    uint256 invocations,
    uint256 maxInvocations,
    bool active,
    address additionalPayee,
    uint256 additionalPayeePercentage
  )
{
  artistAddress = projects[_projectId].artistAddress;
  pricePerTokenInWei = projects[_projectId].pricePerTokenInWei;
  invocations = projects[_projectId].invocations;
  maxInvocations = projects[_projectId].maxInvocations;
  active = projects[_projectId].active;
  additionalPayee = projects[_projectId].additionalPayee;
  additionalPayeePercentage = projects[_projectId].additionalPayeePercentage;
}

projectScriptInfo keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function projectScriptInfo(uint256 _projectId)
  public
  view
  returns (
    string memory scriptJSON,
    uint256 scriptCount,
    uint256 hashes,
    string memory ipfsHash,
    bool locked,
    bool paused
  )
{
  scriptJSON = projects[_projectId].scriptJSON;
  scriptCount = projects[_projectId].scriptCount;
  hashes = projects[_projectId].hashes;
  ipfsHash = projects[_projectId].ipfsHash;
  locked = projects[_projectId].locked;
  paused = projects[_projectId].paused;
}

projectScriptByIndex keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help
_index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function projectScriptByIndex(uint256 _projectId, uint256 _index)
  public
  view
  returns (string memory)
{
  return projects[_projectId].scripts[_index];
}

projectURIInfo keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function projectURIInfo(uint256 _projectId)
  public
  view
  returns (
    string memory projectBaseURI,
    string memory projectBaseIpfsURI,
    bool useIpfs
  )
{
  projectBaseURI = projects[_projectId].projectBaseURI;
  projectBaseIpfsURI = projects[_projectId].projectBaseIpfsURI;
  useIpfs = projects[_projectId].useIpfs;
}

projectShowAllTokens keyboard_arrow_up

Parameters help

Name Type
_projectId
uint help

Properties

Visibility help public
Mutability help view
Source Code
function projectShowAllTokens(uint256 _projectId)
  public
  view
  returns (uint256[] memory)
{
  return projectIdToTokenIds[_projectId];
}

showTokenHashes keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint help

Properties

Visibility help public
Mutability help view
Source Code
function showTokenHashes(uint256 _tokenId)
  public
  view
  returns (bytes32[] memory)
{
  return tokenIdToHashes[_tokenId];
}

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[] memory) {
  return _tokensOfOwner(owner);
}

getRoyaltyData keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getRoyaltyData(uint256 _tokenId)
  public
  view
  returns (
    address artistAddress,
    address additionalPayee,
    uint256 additionalPayeePercentage,
    uint256 royaltyFeeByID
  )
{
  artistAddress = projects[tokenIdToProjectId[_tokenId]].artistAddress;
  additionalPayee = projects[tokenIdToProjectId[_tokenId]].additionalPayee;
  additionalPayeePercentage = projects[tokenIdToProjectId[_tokenId]]
  .additionalPayeePercentage;
  royaltyFeeByID = projects[tokenIdToProjectId[_tokenId]].secondMarketRoyalty;
}

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)
  external
  view
  onlyValidTokenId(_tokenId)
  returns (string memory)
{
  if (bytes(staticIpfsImageLink[_tokenId]).length > 0) {
    return
      Strings.strConcat(
        projects[tokenIdToProjectId[_tokenId]].projectBaseIpfsURI,
        staticIpfsImageLink[_tokenId]
      );
  }

  if (
    !projects[tokenIdToProjectId[_tokenId]].dynamic &&
    projects[tokenIdToProjectId[_tokenId]].useIpfs
  ) {
    return
      Strings.strConcat(
        projects[tokenIdToProjectId[_tokenId]].projectBaseIpfsURI,
        projects[tokenIdToProjectId[_tokenId]].ipfsHash
      );
  }

  return
    Strings.strConcat(
      projects[tokenIdToProjectId[_tokenId]].projectBaseURI,
      Strings.uint2str(_tokenId)
    );
}

Internal Functions Expand All Collapse All

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

internal GenArt721._mintToken keyboard_arrow_up

Parameters help

Name Type
_to
address help
_projectId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _mintToken(address _to, uint256 _projectId)
  internal
  returns (uint256 _tokenId)
{
  uint256 tokenIdToBe = (_projectId * ONE_MILLION) +
    projects[_projectId].invocations;

  projects[_projectId].invocations = projects[_projectId].invocations.add(1);

  for (uint256 i = 0; i < projects[_projectId].hashes; i++) {
    bytes32 hash = keccak256(
      abi.encodePacked(
        projects[_projectId].invocations,
        block.number.add(i),
        msg.sender
      )
    );
    tokenIdToHashes[tokenIdToBe].push(hash);
    hashToTokenId[hash] = tokenIdToBe;
  }

  _mint(_to, tokenIdToBe);

  tokenIdToProjectId[tokenIdToBe] = _projectId;
  projectIdToTokenIds[_projectId].push(tokenIdToBe);

  emit Mint(
    _to,
    tokenIdToBe,
    _projectId,
    projects[_projectId].invocations,
    projects[_projectId].pricePerTokenInWei
  );

  return tokenIdToBe;
}

internal GenArt721._splitFunds keyboard_arrow_up

Parameters help

Name Type
_projectId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _splitFunds(uint256 _projectId) internal {
  if (msg.value > 0) {
    uint256 pricePerTokenInWei = projects[_projectId].pricePerTokenInWei;
    uint256 refund = msg.value.sub(projects[_projectId].pricePerTokenInWei);

    if (refund > 0) {
      msg.sender.transfer(refund);
    }

    uint256 foundationAmount = pricePerTokenInWei.div(100).mul(
      artblocksPercentage
    );
    if (foundationAmount > 0) {
      artblocksAddress.transfer(foundationAmount);
    }

    uint256 projectFunds = pricePerTokenInWei.sub(foundationAmount);

    uint256 additionalPayeeAmount;
    if (projects[_projectId].additionalPayeePercentage > 0) {
      additionalPayeeAmount = projectFunds.div(100).mul(
        projects[_projectId].additionalPayeePercentage
      );
      if (additionalPayeeAmount > 0) {
        projects[_projectId].additionalPayee.transfer(additionalPayeeAmount);
      }
    }

    uint256 creatorFunds = projectFunds.sub(additionalPayeeAmount);
    if (creatorFunds > 0) {
      projects[_projectId].artistAddress.transfer(creatorFunds);
    }
  }
}

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal ERC721._exists keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _exists(uint256 tokenId) internal view returns (bool) {
  address owner = _tokenOwner[tokenId];
  return owner != address(0);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view

Requirements help

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

internal ERC721._mint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

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

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

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(address owner, uint256 tokenId) internal {
  require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own");

  _clearApproval(tokenId);

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

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(uint256 tokenId) internal {
  _burn(ownerOf(tokenId), tokenId);
}

internal ERC721._transferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  require(
    ownerOf(tokenId) == from,
    "ERC721: transfer of token that is not own"
  );
  require(to != address(0), "ERC721: transfer to the zero address");

  _clearApproval(tokenId);

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

  _tokenOwner[tokenId] = to;

  emit Transfer(from, to, tokenId);
}

internal ERC721._checkOnERC721Received keyboard_arrow_up

Parameters help

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

Properties

Visibility help internal
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal returns (bool) {
  if (!to.isContract()) {
    return true;
  }

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

internal ERC721._clearApproval keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

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

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal ERC721Enumerable._transferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  super._transferFrom(from, to, tokenId);

  _removeTokenFromOwnerEnumeration(from, tokenId);

  _addTokenToOwnerEnumeration(to, tokenId);
}

internal ERC721Enumerable._mint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

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

  _addTokenToOwnerEnumeration(to, tokenId);

  _addTokenToAllTokensEnumeration(tokenId);
}

internal ERC721Enumerable._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

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

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

  _removeTokenFromAllTokensEnumeration(tokenId);
}

internal ERC721Enumerable._tokensOfOwner keyboard_arrow_up

Parameters help

Name Type
owner
address help

Properties

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

internal ERC721Enumerable._addTokenToOwnerEnumeration keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

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

internal ERC721Enumerable._addTokenToAllTokensEnumeration keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

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

internal ERC721Enumerable._removeTokenFromOwnerEnumeration keyboard_arrow_up

Parameters help

Name Type
from
address help
tokenId
uint256 help

Properties

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

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

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

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

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

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

internal ERC721Enumerable._removeTokenFromAllTokensEnumeration keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

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

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

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

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

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

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal ERC721._exists keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _exists(uint256 tokenId) internal view returns (bool) {
  address owner = _tokenOwner[tokenId];
  return owner != address(0);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view

Requirements help

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

internal ERC721._mint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

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

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

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(address owner, uint256 tokenId) internal {
  require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own");

  _clearApproval(tokenId);

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

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(uint256 tokenId) internal {
  _burn(ownerOf(tokenId), tokenId);
}

internal ERC721._transferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  require(
    ownerOf(tokenId) == from,
    "ERC721: transfer of token that is not own"
  );
  require(to != address(0), "ERC721: transfer to the zero address");

  _clearApproval(tokenId);

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

  _tokenOwner[tokenId] = to;

  emit Transfer(from, to, tokenId);
}

internal ERC721._checkOnERC721Received keyboard_arrow_up

Parameters help

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

Properties

Visibility help internal
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal returns (bool) {
  if (!to.isContract()) {
    return true;
  }

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

internal ERC721._clearApproval keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

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

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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