Blockwell

Ephimera

About

Stats

Public Functions 15
Event Types 3
Code Size 49,175 bytes

Library Use

Uses SafeMath for uint256.

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

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

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) external view override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

setTokenURI keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_uri
string help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function setTokenURI(uint256 _tokenId, string calldata _uri) external {
        require(owners[_tokenId] != address(0), "EphimeraToken.setTokenURI: token does not exist.");
        require(accessControls.hasAdminRole(_msgSender()), "EphimeraToken.setTokenURI: caller is not a admin.");
        tokenURIs[_tokenId] = _uri;
    }

mint keyboard_arrow_up

Parameters help

Name Type
_to
address help
_uri
string help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function mint(
        address _to,
        string calldata _uri
    ) external returns (uint256) {
        require(_to != address(0), "ERC721: mint to the zero address");
        require(accessControls.hasContractWhitelistRole(_msgSender()), "EphimeraToken.mint: caller is not whitelisted.");

        tokenPointer = tokenPointer.add(1);
        uint256 tokenId = tokenPointer;

        // Mint
        owners[tokenId] = _to;
        balances[_to] = balances[_to].add(1);

        // MetaData
        tokenURIs[tokenId] = _uri;
        totalSupply = totalSupply.add(1);

        tokenTransferCount[tokenId] = 1;

        // Single Transfer event for a single token
        emit Transfer(address(0), _to, tokenId);

        return tokenId;
    }

tokenURI keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function tokenURI(uint256 _tokenId) external view returns (string memory) {
        return tokenURIs[_tokenId];
    }

exists keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

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

burn keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function burn(uint256 _tokenId) external {
        require(_msgSender() == ownerOf(_tokenId), 
            "EphimeraToken.burn: Caller must be owner."
        );
        _burn(_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) override public {
        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
    )
    override
    public
    {
        transferFrom(_from, _to, _tokenId);
        require(_checkOnERC721Received(_from, _to, _tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

approve keyboard_arrow_up

Parameters help

Name Type
_approved
address help
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function approve(address _approved, uint256 _tokenId)
    override
    external
    {
        address owner = ownerOf(_tokenId);
        require(_approved != owner, "ERC721: approval to current owner");
        
        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        approvals[_tokenId] = _approved;
        emit Approval(
            owner,
            _approved,
            _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)
    override
    external
    {
        require(_operator != _msgSender(), "ERC721: approve to caller");

        operatorApprovals[_msgSender()][_operator] = _approved;
        emit ApprovalForAll(
            _msgSender(),
            _operator,
            _approved
        );
    }

balanceOf keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
    function balanceOf(address _owner)
    override
    external
    view
    returns (uint256)
    {
        require(
            _owner != address(0),
            "ERC721: owner query for nonexistent token"
        );
        return balances[_owner];
    }

transferFrom 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 transferFrom(
        address _from,
        address _to,
        uint256 _tokenId
    )
    override
    public
    {
        require(
            _to != address(0),
            "ERC721_ZERO_TO_ADDRESS"
        );

        address owner = ownerOf(_tokenId);
        require(
            _from == owner,
            "ERC721_OWNER_MISMATCH"
        );

        address spender = _msgSender();
        address approvedAddress = getApproved(_tokenId);
        require(
            spender == owner ||
            isApprovedForAll(owner, spender) ||
            approvedAddress == spender,
            "ERC721_INVALID_SPENDER"
        );

        if (approvedAddress != address(0)) {
            approvals[_tokenId] = address(0);
        }

        owners[_tokenId] = _to;
        balances[_from] = balances[_from].sub(1);
        balances[_to] = balances[_to].add(1);

        tokenTransferCount[_tokenId] = tokenTransferCount[_tokenId].add(1);

        emit Transfer(
            _from,
            _to,
            _tokenId
        );
    }

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)
    override
    public
    view
    returns (address)
    {
        address owner = owners[_tokenId];
        require(
            owner != address(0),
            "ERC721: owner query for nonexistent token"
        );
        return owner;
    }

getApproved keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
    function getApproved(uint256 _tokenId)
    override
    public
    view
    returns (address)
    {
        require(owners[_tokenId] != address(0), "ERC721: approved query for nonexistent token");
        return approvals[_tokenId];
    }

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)
    override
    public
    view
    returns (bool)
    {
        return operatorApprovals[_owner][_operator];
    }