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.
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.
| Features | Half Baked Hero |
|---|---|
| ERC-721 Token | ✅ |
| ERC-721 Metadata | ✅ |
| EIP‑721 Metadata Update | ✅ |
| Reveal | On mining complete |
| Metadata | On-Chain |
| Metadata Rendering | Dynamic |
| Images | IPFS |
| Image Rendering | Immutable |
*On-chain means is stored or generated on the Ethereum blockchain directly.
Supply Tokenomics
| Features | Half Baked Hero |
|---|---|
| Blockchain | Ethereum |
| Supply issued at end of mining | 100% |
| Allocated to mining | 100% |
| Reserved for "marketing" | 0% |
| Team allocations | 0% |
| Pre-allocations | 0% |
| VC private sale | 0% |
| Pre-sale | 0% |
| Whitelisting | 0% |
| Vesting | 0% |
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()- Calls
initializePoolsonLiquidityManager - Calls
addPoolsonMementos - Calls
setNameonNameable - Calls
_setDefaultRoyaltyto set the royalties bps and direct the royalties toCertificateOfAuthenticity
- Calls
openMining() payable onlyOwner- Sets
lastMineBlockto current block - Calls
activateTradeWinds()onLiquidityManagerpassing all sent ETH - Calls
bonAppetit()onMementosto renounce that contract
- Sets
receive() payable- 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.
- If first call, initializes
_lastSkillChoiceto a default semi-random number - Checks amount sent is not below minimum mine cost
- Checks amount set is not large than the bitlength we will store this into
- 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- Check are still Heroes to mine
- Get a skill based random number
- Use a variant of Fisher–Yates shuffle to get random hero
- Get block gap since last mining event
- Allocate a portion to devs
- Mine and send a
CertificateOfAuthenticity - Store the current holding; whether G3Verse pass holder and block gap
- 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
LiquidityManagerfunctionreplenishRewards
- 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.
- Mine and send a
HalfBakedHero - 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.