CertificateOfAuthenticity

Git Source

Inherits: ERC721, EIP712, ERC2981, Ownable, ICertificate

Author: Scale Labs Ltd.

Behold! Herein lies the essence of authenticity, each certificate a guardian of history, a beacon of truth in a realm of shadows. It stands as a bulwark against the tides of time, ensuring that the deeds and honor of each hero and their steadfast sidekick remain unaltered and celebrated through the ages.

This solemn tome serves as the immutable chronicle of provenance, where each folio within is a CertificateOfAuthenticity, an onchain artifact etched in the very ether itself. These certificates are not mere documents, but sacred vellum bound by code, depicting the valiant sidekicks of our heroes, alongside every trait and chronicle that composes their legend. In this sanctum, each certificate is a testament to the lineage and lore of its corresponding hero, a chain of custody unbroken and unassailable. The art, a tapestry of SVG, is conjured by the contract's arcane workings, a visual ode to the companions that journey alongside our champions.

State Variables

NAME

string private constant NAME = "Certificate of Authenticity - Half Baked Heroes";

SYMBOL

string private constant SYMBOL = "CAHBH";

ENS_NAME

string public constant ENS_NAME = "certificate.hbhart.eth";

ROYALTY_BPS

uint96 private constant ROYALTY_BPS = 500;

MAX_SUPPLY

uint256 private constant MAX_SUPPLY = 15_000;

nft

ICertifiedNft public immutable nft;

_renderer

IRenderer private _renderer = IRenderer(CERTIFICATERENDERER);

vibesDirection

address public vibesDirection = VIBES_HBH_MULTISIG;

_nextTokenId

uint256 private _nextTokenId = 1;

Functions

onlyHBHContract

onlyHBHContract() restricts function execution to the Half Baked Heroes primary contract.

Modifier ensures only the designated HBH main contract can call the guarded function, maintaining secure contract-to-contract communication.

modifier onlyHBHContract();

constructor

constructor() payable;

name

Returns the name of the token.

function name() public pure virtual override returns (string memory);

symbol

Returns the symbol of the token.

function symbol() public pure virtual override returns (string memory);

maxSupply

maximum total supply.

function maxSupply() external pure returns (uint256);

supportsInterface

function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC2981) returns (bool result);

refreshMetadata

function refreshMetadata(uint256 certId) external onlyHBHContract;

setRenderer

function setRenderer(address renderingContract) external onlyOwner;

tokenURI

A distinct Uniform Resource Identifier (URI) for a given asset.

Throws if tokenId is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".

function tokenURI(uint256 tokenId) public view virtual override returns (string memory);

contractURI

function contractURI() external view returns (string memory);

exists

function exists(uint256 id) external view returns (bool);

notarize

function notarize(address to, uint16 heroId, uint80 ethSent) external onlyHBHContract returns (uint16);

receive

receive() external payable;

updateVibesDirection

Command the cosmic flow of "vibes", the royalties and trading fees, to a new beacon.

Through the sacred ritual of "updateVibesDirection", the "owner" invokes the ancient right to redirect these mystical currents from the hallowed halls of the multisig sanctum to the autonomous altars of future smart contracts. This solemn act is a testament to our evolving saga, a deliberate stride towards an ordained destiny where the "vibes" nourish the roots of a decentralized paradise. Emits a {VibesUpdate} event to herald this new epoch in vibes allocation.

function updateVibesDirection(address newGroove) external onlyOwner;

Parameters

NameTypeDescription
newGrooveaddressThe address of the new custodian of "vibes".

distributeEth

function distributeEth() external;

distributeToken

function distributeToken(address tokenAddress) external;

provenanceData

function provenanceData(uint256 id)
    external
    view
    returns (uint16 heroId, uint80 ethSent, ProvenanceTransferEvent[] memory provenance);

latestProvenanceData

function latestProvenanceData(uint256 id, uint256 maxCount)
    external
    view
    returns (uint16 heroId, uint80 ethSent, ProvenanceTransferEvent[] memory provenance, uint256 length);

isApprovedOrOwner

function isApprovedOrOwner(address account, uint256 id) public view virtual returns (bool);

_domainNameAndVersion

function _domainNameAndVersion() internal pure override returns (string memory tokenName, string memory version);

DOMAIN_SEPARATOR

function DOMAIN_SEPARATOR() external view returns (bytes32);

transferEthPassError

function transferEthPassError(address to, uint256 value) private;

_checkIsHeroesContract

Ensures that the calling entity is the esteemed HBHART contract, the sanctum of our heroes. It is a safeguard that permits only the HBHART, the creator of legends, to initiate the sacred call. Any impostor invoking this ritual without being the HBHART shall be denied with the decree "Not HBH".

function _checkIsHeroesContract() private view;

Events

MetadataUpdate

This event emits when the metadata of a token is changed. So that the third-party platforms such as NFT market could timely update the images and related attributes of the NFT.

event MetadataUpdate(uint256 _tokenId);

BatchMetadataUpdate

This event emits when the metadata of a range of tokens is changed. So that the third-party platforms such as NFT market could timely update the images and related attributes of the NFTs.

event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);

VibesUpdate

This event emits when the vibesDirection address is changed.

event VibesUpdate(address indexed newGroove);