Skip to main content

Trait Randomization

Traits can be common, uncommon, rare, epic, or legendary. For each category, we spin a deterministic on-chain wheel using the core contract’s per-auction seed.
  • Seed source: core.getAuctionSeed(auctionId) returns a per‑auction seed derived in the core contract from chain data.
  • getTrait(category, auctionId):
    1. Sums weight across all traits in category.
    2. Computes rand = H(category, auctionId, seed) % totalWeight.
    3. Scans cumulatively over traits; the bucket where rand < acc is the selected trait name.
  • Given the same auctionIdand trait table, selection is reproducible across nodes and time. That means the artwork for an auction is fixed once the seed is set for a given auction in the core contract.

Layer Retrieval

The same auctionId + same trait tables = the same result forever. Everyone renders the same art because everything about the brew lives on-chain.
  • getSVGFragment(category, traitName): Looks up the stored SVG fragment string for the named trait.
  • getTraits(auctionId): Convenience that resolves the selected trait names for each category in canonical order (Background, Brew, Mug, Top).

SVG Composition (The Image Itself)

The renderer stitches the SVG, Base64-encodes it, and serves it inside the token’s tokenURI as a data URI—no IPFS pins to rot, no servers to trust. Metadata includes the four trait names so marketplaces can show attributes cleanly.
  • buildSVG(auctionId):
    1. Starts with an <svg> root sized 1080×1080.
    2. For each category in categories order, resolves the chosen name with getTrait and fetches its fragment with getSVGFragment.
    3. Concatenates fragments in order to form a single SVG document.
    4. Appends the closing </svg> tag and returns the complete image string.
Layering matters: The array order is the z‑order. Background is written first, then Brew, then Mug, then Top.

Backgrounds

NameRarityWeight
BlueCommon
Pink
Purple
Black

Brews

NameRarityWeight
Miner LiteCommon
Blockweiser
gweiness
HOLDweisen
Bandit IPA
Juicy Brew
Stoutoshi
Slime

Mugs

NameRarityWeight
GlassCommon
Ceramic
Ice
Wood
Steel
Charcoal
Rose Gold
Gold
Holographic
Earth

Tops

NameRarityWeight
Regular FoamCommon
Flat FoamCommon
Tall FoamCommon
Drippy Foam
Igloo
Fyre
Duck
Diamond
Rain
Red Trucker
Green Trucker
Rainbow
Poop
Skull