Skip to content

NFT Marketplace Compiler

Compiles HoloScript spatial asset definitions to NFT marketplace integrations — generating smart contract configurations, metadata standards, and Web3 wallet interactions for spatial 3D assets.

Overview

The NFT marketplace compiler (--target nft-marketplace) generates the Web3 infrastructure to list, sell, and transfer HoloScript spatial objects as NFTs. A .holo file describing a virtual sword, a piece of virtual land, or a 3D wearable becomes a tokenized asset with on-chain provenance.

bash
holoscript compile items.holo --target nft-marketplace --chain polygon --output ./web3/

Output Structure

web3/
  contracts/
    HoloAsset.sol          # ERC-1155 multi-token contract
    HoloMarketplace.sol    # Marketplace contract
  metadata/
    [id].json              # ERC-721/1155 metadata per asset
    assets/                # IPFS-staged 3D files
  scripts/
    deploy.ts              # Hardhat deploy script
    mint.ts                # Minting interface
  frontend/
    marketplace.tsx        # React marketplace UI

Trait → Web3 Mapping

HoloScript TraitWeb3 Behaviour
@nft_assetAsset is tokenized as ERC-1155
@token_gatedRequires NFT ownership to spawn/enter
@marketplaceListed in HoloScript marketplace
@walletUser wallet connection (MetaMask/Coinbase)
@zora_coinsZora Protocol ERC-20 creator coins
@economy_primitiveIn-world economy (crafting, trading)
@persistentState synced to on-chain via IPFS + events
@ownedOwnership tracked to wallet address

Example

holo
composition "VirtualArmoury" {
  template "SpatialSword" {
    @nft_asset
    @grabbable
    @equippable
    @marketplace

    geometry: "model/sword.glb"

    nft: {
      contract: "ERC-1155"
      chain: "polygon"
      royalty: 5          // 5% creator royalty
      editions: 100       // Limited to 100
      price: "0.05 ETH"
    }

    on_equip {
      player.equip(this)
      haptic.feedback("medium")
    }
  }

  object "ExcaliburSword" using "SpatialSword" {
    position: [0, 1, -2]
    nft.editions: 1       // 1/1 unique
    nft.price: "1.0 ETH"
  }
}

ERC-1155 Metadata Output

json
{
  "name": "Excalibur Sword",
  "description": "A legendary HoloScript spatial asset",
  "image": "ipfs://QmXxx.../preview.png",
  "animation_url": "ipfs://QmXxx.../sword.glb",
  "properties": {
    "holoscript_composition": "ipfs://QmXxx.../armoury.holo",
    "traits": ["nft_asset", "grabbable", "equippable"],
    "geometry": "model/sword.glb",
    "chain": "polygon",
    "editions": 1
  }
}

Supported Chains

ChainStandardGas Optimization
PolygonERC-1155GasOptimizationAnalyzer runs auto
EthereumERC-721Estimated gas in output report
BaseERC-1155OP Stack L2, low gas
ZoraZora CreatorZora coins + creator rewards
ArbitrumERC-1155OP rollup

Gas Optimization

The compiler includes GasOptimizationAnalyzer which automatically:

  • Batches mint operations into multi-mint calls
  • Uses ERC-1155 over ERC-721 for multiple editions
  • Suggests lazy minting for large collections
  • Reports gas estimate per operation in the build output

Compiler Options

OptionDefaultDescription
--chainpolygonTarget blockchain
--standarderc1155Token standard: erc721 or erc1155
--ipfs-gatewaynft.storageIPFS pin service
--royalty5Default creator royalty (%)
--marketplace-backendhololandMarketplace: hololand, opensea, zora

See Also

Released under the MIT License.