HBH Logo HalfBakedHeroes (HalfBakedHeroes.sol)

The 'Half Baked Heroes' collection offers an innovative and interactive approach to NFT mining, celebrating the diverse personalities and stories within the Web3 community. This unique collection consists of 15,000 distinct characters, with each NFT portraying a character navigating the intricate maze of Web3's challenges and opportunities.

To mine an NFT from this collection, participants send ETH to the designated hbhart.eth address. The mining process is facilitated by the receive() function, which not only assigns the msg.sender a Half Baked Hero NFT with a semi-randomly assigned ID but also generates a sequential ID certificate specific to that Hero. In addition to these items, the process awards a quantity of Memento tokens.

Example Half Baked Hero
Example "The Dev" Half Baked Hero

Each Hero NFT is designed to be independently transferable from its corresponding certificate. This allows for flexible ownership and trading possibilities. The tokenURI metadata of each Hero NFT is dynamically generated on-chain by a specialized renderer. This renderer not only updates the metadata in real-time but also links to an image hosted on IPFS, ensuring a permanent, decentralized record of the artwork.

This innovative mining process not only ensures that each Half Baked Hero is a living part of the Web3 narrative but also enhances security significantly. Participants can mine an NFT without the need to connect their wallet to a website; instead, they simply send ETH to the designated address. This method minimizes potential security risks associated with wallet integration on websites, offering a safer and more streamlined approach to acquiring these unique digital assets.

FeaturesHalf Baked Hero
ERC-721 Token
ERC-721 Metadata
EIP‑721 Metadata Update
RevealOn mining complete
MetadataOn-Chain
Metadata RenderingDynamic
ImagesIPFS
Image RenderingImmutable

*On-chain means is stored or generated on the Ethereum blockchain directly.

Supply Tokenomics

FeaturesHalf Baked Hero
BlockchainEthereum
Supply issued at end of mining100%
Allocated to mining100%
Reserved for "marketing"0%
Team allocations0%
Pre-allocations0%
VC private sale0%
Pre-sale0%
Whitelisting0%
Vesting0%

The key feature of this contract is:

  • ERC721 NFT with all behaviours
flowchart TD
    W -->|Send fab:fa-ethereum ETH| C
    C -->| far:fa-clock not<br>started| R
    C -->| 15,000 HBH<br>already  mined| R
    C -->| < min ETH| R
    C --> | >= min ETH| M
    M --> |one| D
    M --> |one| E
    M --> |Based on ETH send| V
    V --> |mine reserves<br>formula| MP2(* Mining Pool)
    V --> |no reserves<br>market rate| LP2(* Liquidity Pool)
    W[fab:fa-ethereum Wallet]
    M{fas:fa-check-circle Mine}
    R(fas:fa-times-circle Revert)
    C{fas:fa-code hbhnft.eth}
    D["fas:fa-portrait Half Baked Heroes (HBH)"<br>ERC-721 NFT<br>Meta: OnChain<br>Image: IPFS<br>Reveal: Mining Complete]
        E["fa:fa-certificate HBH Certificate of Authenticity (CAHBH)"<br>ERC-721 NFT<br>Meta: OnChain<br>Image: OnChain<br>Reveal: Immediately]
    O[Mined Output -> Wallet]
    MP2 --> O
    LP2 --> O
    D --> O
    E --> O 
    V{"Mine Mementos (MOTE)<br>Amount: Based on tx send<br>No reserves -> market rate"}

Non-standard EOA callable non-view functions on this contract

  • constructor()
    1. Calls initializePools on LiquidityManager
    2. Calls addPools on Mementos
    3. Calls setName on Nameable
    4. Calls _setDefaultRoyalty to set the royalties bps and direct the royalties to CertificateOfAuthenticity
  • openMining() payable onlyOwner
    1. Sets lastMineBlock to current block
    2. Calls activateTradeWinds() on LiquidityManager passing all sent ETH
    3. Calls bonAppetit() on Mementos to renounce that contract
  • receive() payable
    1. Mining is done by directly sending ETH to this contract; avoiding risks from connecting wallet to a website and authorizing complex transactions it send to your wallet.
    2. If first call, initializes _lastSkillChoice to a default semi-random number
    3. Checks amount sent is not below minimum mine cost
    4. Checks amount set is not large than the bitlength we will store this into
    5. Calls _excavate()
  • reveal(address) onlyOwner
    • Updates the renderer contract; confirming it's code matches the provenance hash set before deployment. (To prove devs didn't change NFT decoding after minting)
    • emits BatchMetadataUpdate(uint256, uint256)
  • errorsAndOmissionsExcepted(address) onlyOwner
    • Updates the renderer contract; as escape hatch to correct any issues discovered after reveal; or set initial unrevealed renderer.
    • emits BatchMetadataUpdate(uint256, uint256)
  • feedDevs()
    • Pull payment method
  • cleanseThePalate()
    • Pull payment method
  • burnRemaining() onlyHeroes
    • Burns any remaining Mementos (MOTE) tokens in the contract only after mining is complete.

Notable private or internal functions on this contract

  • _excavate() private

    1. Check are still Heroes to mine
    2. Get a skill based random number
    3. Use a variant of Fisher–Yates shuffle to get random hero
    4. Get block gap since last mining event
    5. Allocate a portion to devs
    6. Mine and send a CertificateOfAuthenticity
    7. Store the current holding; whether G3Verse pass holder and block gap
    8. Allocate 4000 gwei * sqrt(ETH sent * 1 gwei) Memento tokens to miner
      • If enough tokens available in HalfBakedHeroes send directly
      • If not use 50% of the ETH sent to replenish the token supply from market via LiquidityManager function replenishRewards
    9. Use 20% of the ETH sent for an additional reward at the rate the market determines; capped at a maximum of the initial allocation, with the remaining staying in contract as additional reward replenishment.
    10. Mine and send a HalfBakedHero
    11. emit a HeroFullyCooked(heroId, certificateId, mementosCount) event
  • _afterTokenTransfer(address, address, uint256) internal

    • Refreshes Certificate metadata
    • If current receiver now holds the record on Heroes NFTs held, updates record against account to note this datetime and count; and stores as new top holder record.