Blockwell

DigitalaxGenesis

About

Stats

Public Functions 23
Event Types 9
Code Size 74,954 bytes

Library Use

Uses SafeMath for uint256.

Events (9) keyboard_arrow_up

AccessControlsUpdated Event

Parameters help
newAdress
address help

AdminGenesisMinted Event

Parameters help
beneficiary
address help
admin
address help
tokenId
uint256 help

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

ContributionIncreased Event

Parameters help
buyer
address help
contribution
uint256 help

DigitalaxGenesisNFTContractDeployed Event

Parameters help

GenesisEndUpdated Event

Parameters help
genesisEndTimestamp
uint256 help
admin
address help

GenesisPurchased Event

Parameters help
buyer
address help
tokenId
uint256 help
contribution
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

minimumContributionAmount Constant

uint256 help
0.1 ether

maximumContributionAmount Constant

uint256 help
2 ether

maxGenesisContributionTokens Constant

uint256 help
460

_ERC721_RECEIVED Constant

bytes4 help
0x150b7a02

_INTERFACE_ID_ERC721 Constant

bytes4 help
0x80ac58cd

_INTERFACE_ID_ERC721_METADATA Constant

bytes4 help
0x5b5e139f

_INTERFACE_ID_ERC721_ENUMERABLE Constant

bytes4 help
0x780e9d63

_INTERFACE_ID_ERC165 Constant

bytes4 help
0x01ffc9a7

accessControls Variable

address help

fundsMultisig Variable

address help

genesisStartTimestamp Variable

uint256 help

genesisEndTimestamp Variable

uint256 help

genesisEndTimestampLocked Variable

bool help

totalContributions Variable

uint256 help

totalAdminMints Variable

uint256 help

tokenURI_ Variable

string help

contribution Variable

mapping(address => uint256) help

_holderTokens Variable

mapping(address => EnumerableSet.UintSet) help
Internal Variable

_tokenOwners Variable

EnumerableMap.UintToAddressMap help
Internal Variable

_tokenApprovals Variable

mapping(uint256 => address) help
Internal Variable

_operatorApprovals Variable

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

_name Variable

string help
Internal Variable

_symbol Variable

string help
Internal Variable

_supportedInterfaces Variable

mapping(bytes4 => bool) help
Internal Variable

Functions Expand All Collapse All

supportsInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

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

Parameters help

Name Type
owner
address help

Properties

Visibility help public
Mutability help view

Requirements help

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

  return _holderTokens[owner].length();
}

ownerOf keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function ownerOf(uint256 tokenId) public view override returns (address) {
  return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
}

Parameters help

This function has no parameters.

Properties

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

Parameters help

This function has no parameters.

Properties

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

tokenURI keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

null
Source Code
function tokenURI(uint256 tokenId)
  public
  view
  override
  returns (string memory)
{
  require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

  return tokenURI_;
}

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
  override
  returns (uint256)
{
  return _holderTokens[owner].at(index);
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() public view override returns (uint256) {
  // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
  return _tokenOwners.length();
}

tokenByIndex keyboard_arrow_up

Parameters help

Name Type
index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function tokenByIndex(uint256 index) public view override returns (uint256) {
  (uint256 tokenId, ) = _tokenOwners.at(index);
  return 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 virtual override {
  address owner = ownerOf(tokenId);
  require(to != owner, "ERC721: approval to current owner");

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

  _approve(to, tokenId);
}

getApproved keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

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

  return _tokenApprovals[tokenId];
}

setApprovalForAll keyboard_arrow_up

Parameters help

Name Type
operator
address help
approved
bool help

Properties

Visibility help public
Mutability help transaction

Requirements help

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

  _operatorApprovals[_msgSender()][operator] = approved;
  emit ApprovalForAll(_msgSender(), operator, 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
  override
  returns (bool)
{
  return _operatorApprovals[owner][operator];
}

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

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

  _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
Source Code
function safeTransferFrom(
  address from,
  address to,
  uint256 tokenId
) public virtual override {
  safeTransferFrom(from, to, tokenId, "");
}

safeTransferFrom keyboard_arrow_up

Parameters help

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

Properties

Visibility help public
Mutability help transaction
Source Code
function safeTransferFrom(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) public virtual override {
  require(
    _isApprovedOrOwner(_msgSender(), tokenId),
    "ERC721: transfer caller is not owner nor approved"
  );
  _safeTransfer(from, to, tokenId, _data);
}

buyOrIncreaseContribution keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function buyOrIncreaseContribution() external payable {
  if (contribution[_msgSender()] == 0) {
    buy();
  } else {
    increaseContribution();
  }
}

buy keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Requirements help

null
Source Code
function buy() public payable {
  require(
    contribution[_msgSender()] == 0,
    "DigitalaxGenesisNFT.buy: You already own a genesis NFT"
  );
  require(
    _getNow() >= genesisStartTimestamp && _getNow() <= genesisEndTimestamp,
    "DigitalaxGenesisNFT.buy: No genesis are available outside of the genesis window"
  );

  uint256 _contributionAmount = msg.value;
  require(
    _contributionAmount >= minimumContributionAmount,
    "DigitalaxGenesisNFT.buy: Contribution does not meet minimum requirement"
  );

  require(
    _contributionAmount <= maximumContributionAmount,
    "DigitalaxGenesisNFT.buy: You cannot exceed the maximum contribution amount"
  );

  require(
    remainingGenesisTokens() > 0,
    "DigitalaxGenesisNFT.buy: Total number of genesis token holders reached"
  );

  contribution[_msgSender()] = _contributionAmount;
  totalContributions = totalContributions.add(_contributionAmount);

  (bool fundsTransferSuccess, ) = fundsMultisig.call{
    value: _contributionAmount
  }("");
  require(
    fundsTransferSuccess,
    "DigitalaxGenesisNFT.buy: Unable to send contribution to funds multisig"
  );

  uint256 tokenId = totalSupply().add(1);
  _safeMint(_msgSender(), tokenId);

  emit GenesisPurchased(_msgSender(), tokenId, _contributionAmount);
}

increaseContribution keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Requirements help

Source Code
function increaseContribution() public payable {
  require(
    _getNow() >= genesisStartTimestamp && _getNow() <= genesisEndTimestamp,
    "DigitalaxGenesisNFT.increaseContribution: No increases are possible outside of the genesis window"
  );

  require(
    contribution[_msgSender()] > 0,
    "DigitalaxGenesisNFT.increaseContribution: You do not own a genesis NFT"
  );

  uint256 _amountToIncrease = msg.value;
  contribution[_msgSender()] = contribution[_msgSender()].add(
    _amountToIncrease
  );

  require(
    contribution[_msgSender()] <= maximumContributionAmount,
    "DigitalaxGenesisNFT.increaseContribution: You cannot exceed the maximum contribution amount"
  );

  totalContributions = totalContributions.add(_amountToIncrease);

  (bool fundsTransferSuccess, ) = fundsMultisig.call{value: _amountToIncrease}(
    ""
  );
  require(
    fundsTransferSuccess,
    "DigitalaxGenesisNFT.increaseContribution: Unable to send contribution to funds multisig"
  );

  emit ContributionIncreased(_msgSender(), _amountToIncrease);
}

adminBuy keyboard_arrow_up

Parameters help

Name Type
_beneficiary
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function adminBuy(address _beneficiary) external {
  require(
    accessControls.hasAdminRole(_msgSender()),
    "DigitalaxGenesisNFT.adminBuy: Sender must be admin"
  );
  require(
    _beneficiary != address(0),
    "DigitalaxGenesisNFT.adminBuy: Beneficiary cannot be ZERO"
  );
  require(
    balanceOf(_beneficiary) == 0,
    "DigitalaxGenesisNFT.adminBuy: Beneficiary already owns a genesis NFT"
  );

  uint256 tokenId = totalSupply().add(1);
  _safeMint(_beneficiary, tokenId);

  // Increase admin mint counts
  totalAdminMints = totalAdminMints.add(1);

  emit AdminGenesisMinted(_beneficiary, _msgSender(), tokenId);
}

updateGenesisEnd keyboard_arrow_up

Parameters help

Name Type
_end
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateGenesisEnd(uint256 _end) external {
  require(
    accessControls.hasAdminRole(_msgSender()),
    "DigitalaxGenesisNFT.updateGenesisEnd: Sender must be admin"
  );
  // If already passed, dont allow opening again
  require(
    genesisEndTimestamp > _getNow(),
    "DigitalaxGenesisNFT.updateGenesisEnd: End time already passed"
  );

  // Only allow setting this once
  require(
    !genesisEndTimestampLocked,
    "DigitalaxGenesisNFT.updateGenesisEnd: End time locked"
  );

  genesisEndTimestamp = _end;

  // Lock future end time modifications
  genesisEndTimestampLocked = true;

  emit GenesisEndUpdated(genesisEndTimestamp, _msgSender());
}

updateAccessControls keyboard_arrow_up

Parameters help

Name Type
_accessControls
DigitalaxAccessControls help

Properties

Visibility help public
Mutability help transaction

Requirements help

UNKNOWN VALUE must not be equal to UNKNOWN VALUE
Source Code
function updateAccessControls(DigitalaxAccessControls _accessControls)
  external
{
  require(
    accessControls.hasAdminRole(_msgSender()),
    "DigitalaxGenesisNFT.updateAccessControls: Sender must be admin"
  );
  require(
    address(_accessControls) != address(0),
    "DigitalaxGenesisNFT.updateAccessControls: Zero Address"
  );
  accessControls = _accessControls;

  emit AccessControlsUpdated(address(_accessControls));
}

remainingGenesisTokens keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function remainingGenesisTokens() public view returns (uint256) {
  return _getMaxGenesisContributionTokens() - (totalSupply() - totalAdminMints);
}

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 DigitalaxGenesisNFT._getNow keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _getNow() internal view virtual returns (uint256) {
  return block.timestamp;
}

internal DigitalaxGenesisNFT._getMaxGenesisContributionTokens keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _getMaxGenesisContributionTokens()
  internal
  view
  virtual
  returns (uint256)
{
  return maxGenesisContributionTokens;
}

internal DigitalaxGenesisNFT._beforeTokenTransfer 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 _beforeTokenTransfer(
  address from,
  address to,
  uint256 tokenId
) internal override {
  if (from != address(0) && _getNow() <= genesisEndTimestamp) {
    revert(
      "DigitalaxGenesisNFT._beforeTokenTransfer: Transfers are currently locked at this time"
    );
  }
}

internal ERC721WithSameTokenURIForAllTokens._safeTransfer 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 _safeTransfer(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal virtual {
  _transfer(from, to, tokenId);
  require(
    _checkOnERC721Received(from, to, tokenId, _data),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
}

internal ERC721WithSameTokenURIForAllTokens._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) {
  return _tokenOwners.contains(tokenId);
}

internal ERC721WithSameTokenURIForAllTokens._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 ERC721WithSameTokenURIForAllTokens._safeMint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _safeMint(address to, uint256 tokenId) internal virtual {
  _safeMint(to, tokenId, "");
}

internal ERC721WithSameTokenURIForAllTokens._safeMint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _safeMint(
  address to,
  uint256 tokenId,
  bytes memory _data
) internal virtual {
  _mint(to, tokenId);
  require(
    _checkOnERC721Received(address(0), to, tokenId, _data),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
}

internal ERC721WithSameTokenURIForAllTokens._mint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

  _beforeTokenTransfer(address(0), to, tokenId);

  _holderTokens[to].add(tokenId);

  _tokenOwners.set(tokenId, to);

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

internal ERC721WithSameTokenURIForAllTokens._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 virtual {
  address owner = ownerOf(tokenId);

  _beforeTokenTransfer(owner, address(0), tokenId);

  // Clear approvals
  _approve(address(0), tokenId);

  _holderTokens[owner].remove(tokenId);

  _tokenOwners.remove(tokenId);

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

internal ERC721WithSameTokenURIForAllTokens._transfer 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 _transfer(
  address from,
  address to,
  uint256 tokenId
) internal virtual {
  require(
    ownerOf(tokenId) == from,
    "ERC721: transfer of token that is not own"
  );
  require(to != address(0), "ERC721: transfer to the zero address");

  _beforeTokenTransfer(from, to, tokenId);

  // Clear approvals from the previous owner
  _approve(address(0), tokenId);

  _holderTokens[from].remove(tokenId);
  _holderTokens[to].add(tokenId);

  _tokenOwners.set(tokenId, to);

  emit Transfer(from, to, tokenId);
}

internal ERC721WithSameTokenURIForAllTokens._checkOnERC721Received keyboard_arrow_up

Parameters help

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

Properties

Visibility help private
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) private returns (bool) {
  if (!to.isContract()) {
    return true;
  }
  bytes memory returndata = to.functionCall(
    abi.encodeWithSelector(
      IERC721Receiver(to).onERC721Received.selector,
      _msgSender(),
      from,
      tokenId,
      _data
    ),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
  bytes4 retval = abi.decode(returndata, (bytes4));
  return (retval == _ERC721_RECEIVED);
}

internal ERC721WithSameTokenURIForAllTokens._approve keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _approve(address to, uint256 tokenId) private {
  _tokenApprovals[tokenId] = to;
  emit Approval(ownerOf(tokenId), to, tokenId);
}

internal ERC721WithSameTokenURIForAllTokens._beforeTokenTransfer 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 _beforeTokenTransfer(
  address from,
  address to,
  uint256 tokenId
) internal virtual {}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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