Deploy a collection

This guide uses the v1 factory and minter. For current v2 contracts, use Surface v2, Launcher, and FixedPriceSale. V2 has a single minter slot, exact fixed-price payment, and a separate optional gate. Its creation and mint signatures differ from v1; use the matching ABI.

SurfaceFactory.createSurface deploys a sequential collection and its canonical minter together in one transaction: it clones the Surface implementation via EIP-1167, clones a FixedPriceMinter bound to it, grants the minter, and configures both. Both clones are immutable: no proxy admin, no upgrade path. What deploys is what runs. After deploy, the artist (the owner) controls the renderer slot and config on the token and the sale config on the minter; the clones' code never changes.

solidity
function createSurface(
    string calldata name,
    string calldata symbol,
    address owner,
    SurfaceConfig calldata cfg,
    SaleConfig calldata sale,
    address[] calldata creators
) external returns (address collection, address minter);
  • name / symbol: standard ERC721 metadata
  • owner: the artist. Taken explicitly so a deploy helper (studio backend, multisig) can deploy on an artist's behalf
  • cfg: the token's SurfaceConfig struct, below
  • sale: the canonical minter's SaleConfig struct, below
  • creators: an optional initial creator listing (the owner's side of attribution), seeded on the collection at init. Each listed creator completes the handshake by claiming the collection in their own Catalog, after which isConfirmedCreator reads true. Empty for solo works (owner() is the creator)

The call returns (collection, minter) and emits SurfaceCreated(owner, collection, primaryMinter, idMode, name, symbol), the single event an indexer needs to discover the collection, its metadata, and its minter binding. It also records the collection in isSurface / allSurfaces.

Two sibling entrypoints skip the canonical minter: createSurfaceCustom(name, symbol, owner, cfg, initialMinters, primaryMinter, creators) deploys a sequential collection wired to minters you supply, and createPooledSurface(name, symbol, owner, cfg, initialMinters, primaryMinter, creators) deploys a pooled collection (there is no canonical-minter form for pooled). On both, primaryMinter must be address(0) or an entry of initialMinters, else the call reverts PrimaryMinterNotAuthorized, and SurfaceCreated carries whatever you passed.

SurfaceConfig (the token)

solidity
struct SurfaceConfig {
    uint256 supplyCap;       // 0 = open supply
    uint16 royaltyBps;       // EIP-2981, advisory
    address royaltyReceiver; // 0 = owner()
    address renderer;        // falls back to factory defaultRenderer; required
    bool rendererLocked;     // one-way; see lockRenderer
    bool supplyLocked;       // one-way; see lockSupply
}
  • supplyCap bounds mints ever on a sequential collection (burns never free a new slot). 0 is uncapped. The cap binds every minter, so no grant can exceed it
  • royaltyBps is capped at 5000 (50%); deploy reverts RoyaltyTooHigh above that
  • renderer is the one token slot. Passing 0 falls back to the factory's defaultRenderer; the resolved address must be a deployed contract or the call reverts RendererRequired (zero) or RendererNotContract. On the mainnet factory defaultRenderer is the zero address, so pass your own renderer. It is changeable later with setRenderer until lockRenderer
  • rendererLocked / supplyLocked passed true initialize the collection locked, with no second transaction. Both are one-way

SaleConfig (the canonical minter)

solidity
struct SaleConfig {
    uint256 price;          // wei; used when priceStrategy is unset
    address priceStrategy;  // 0 = fixed price
    uint64 mintStart;       // unix seconds; 0 = open immediately
    uint64 mintEnd;         // unix seconds; 0 = open-ended
    address payoutRecipient;// 0 = the deploy-time owner argument
    uint256 maxMints;       // 0 = unlimited; this minter's own sale ceiling
    bytes32 allowlistRoot;  // 0 = open
    uint256 walletCap;      // 0 = unlimited; per-recipient
}

The factory fills the minter's collection field with the token clone it creates in the same call, so SaleConfig is FixedPriceMinterInitParams minus collection. Every field here is live config on the minter after deploy (setPrice, setPriceStrategy, setMintWindow, setPayoutRecipient, setMaxMints, setAllowlistRoot, setWalletCap), authorized by the collection's owner or an admin. payoutRecipient is stored once at init and is never re-derived from the collection's live owner(), so a renounced or transferred collection keeps paying whoever is stored. The referral share is not in SaleConfig: the minter initializes referralShareBps to its cap, MAX_REFERRAL_SHARE_BPS = 1000 (10%), and the owner or an admin changes it with setReferralShareBps. See Mint for how these drive a mint.

Generative works: bring your own renderer

createSurface takes no work-config parameter. A generative work ships as its own renderer: deploy a work-specific IRenderer that owns its algorithm and dependency references (however it chooses to store them), then point the collection's renderer slot at it, either as cfg.renderer at deploy or later with setRenderer. Edition presets and Solidity-SVG works point cfg.renderer at a shared metadata renderer or a self-contained SVG renderer, where the renderer contract itself is the work. Leaving cfg.renderer at zero only works when the factory carries a defaultRenderer, and the mainnet factory does not. See Write a renderer and the Injection convention.

Deploying with viem

ts
import {createWalletClient, createPublicClient, http, parseEther} from 'viem';
import {mainnet} from 'viem/chains';
import {surfaceFactoryAbi} from '@pin/abi';

const FACTORY = '0xdB81d3F33EF3D84685486916E0d372E247558094';
const ZERO = '0x0000000000000000000000000000000000000000';

const publicClient = createPublicClient({
  chain: mainnet,
  transport: http('https://mainnet.gateway.tenderly.co'),
});
const walletClient = createWalletClient({
  chain: mainnet,
  transport: http('https://mainnet.gateway.tenderly.co'),
});

const cfg = {
  supplyCap: 250n,
  royaltyBps: 500,
  royaltyReceiver: ZERO,
  renderer: rendererAddress, // required: the mainnet factory has no default
  rendererLocked: false,
  supplyLocked: false,
};

const sale = {
  price: parseEther('0.02'),
  priceStrategy: ZERO,     // fixed price
  mintStart: 0n,
  mintEnd: 0n,
  payoutRecipient: ZERO,   // defaults to the owner argument above
  maxMints: 0n,
  allowlistRoot: '0x0000000000000000000000000000000000000000000000000000000000000000',
  walletCap: 0n,
};

const hash = await walletClient.writeContract({
  address: FACTORY,
  abi: surfaceFactoryAbi,
  functionName: 'createSurface',
  // (name, symbol, owner, cfg, sale, creators)
  args: ['Field Notes', 'FIELD', artistAddress, cfg, sale, []],
});

const receipt = await publicClient.waitForTransactionReceipt({hash});

The new collection and minter addresses are in the SurfaceCreated event of the receipt's logs, and are also the return values of createSurface if you call it through a contract rather than an EOA transaction.

After deploy

On the token, the owner can still call setRenderer and the config setters until they lock things down with lockRenderer and lockSupply, and manage minters with setMinter / lockMinter. On the minter, the owner (or an admin they grant on the collection) can change the sale config. Presentation data is published separately: a generative work lives in the artist's own renderer, and historical v1 renderers could use a RenderAssets registry for covers and captures. That module's source and reference have been retired; a custom renderer defines its own presentation storage. Nothing about either clone's code changes; only its slot pointers and stored config do. See: