SurfaceFactory

0xdB81d3F33EF3D84685486916E0d372E247558094 · view on evm.now · Ethereum mainnet

Deploys one Surface collection per call as an EIP-1167 clone of a fixed implementation: no proxy admin, no upgrade path. createSurface clones the sequential token and a FixedPriceMinter, initializes both, and grants the minter, in one transaction. createSurfaceCustom (sequential) and createPooledSurface (pooled) clone only the token and grant the minters the caller passes, plus a caller-chosen primaryMinter (frontend-discovery default) validated against that grant list. The factory takes no fee.

An indexer reads one SurfaceCreated event per collection, carrying the chosen primary minter (the canonical clone on createSurface, the caller's choice or zero on the two custom paths), plus the allSurfaces array and the isSurface map for enumeration. A new implementation ships behind a new factory. deprecate is a one-way stop for this factory's deploy paths; setPaused is a reversible pause.

Concepts

One transaction, two clones

createSurface clones the token (uninitialized), clones the minter and initializes it bound to the token with the caller's SaleConfig, then initializes the token with the minter as its sole initial minter. Clone order matters because the minter's initialize requires the collection address to have code, which an EIP-1167 clone has after Clones.clone. The two custom paths skip the minter clone and initialize the token with the caller's initialMinters.

SaleConfig

The sale argument to createSurface is the canonical minter's config, minus the collection address the factory fills in. Each field is settable on the minter afterward by the collection's owner or admin.

Field Type Meaning
price uint256 Price per token in wei, used when priceStrategy is unset
priceStrategy address 0 uses the fixed price; a set strategy quotes the price
mintStart uint64 Sale start, unix seconds; 0 opens immediately
mintEnd uint64 Sale end, unix seconds; 0 is open-ended
payoutRecipient address Where the artist share accrues; 0 defaults to the deploy-time owner argument
maxMints uint256 This minter's sale ceiling; 0 is unlimited
allowlistRoot bytes32 Merkle allowlist root; 0 is no allowlist
walletCap uint256 Per-recipient mint cap; 0 is unlimited

Creator listing at init

The creators argument sets the collection's listed-creator set during initialize, emitting CreatorListed per address. This is the collection's own storage, not a shared-registry write: the Catalog is only read. A listed creator confirms by claiming the collection in the Catalog from their own address, after which isConfirmedCreator reads true. Pass an empty array for solo works; the owner can change the listing later with setCreators.

Write functions

createSurface

solidity
function createSurface(string name, string symbol, address owner, SurfaceConfig cfg, SaleConfig sale, address[] creators) external returns (address collection, address minter)

Access: permissionless (anyone may deploy; control belongs to the owner argument)

Deploys a sequential collection wired to a canonical FixedPriceMinter clone in one transaction: clones the token, clones and initializes the minter bound to it with sale, then initializes the token with the minter as its sole initial minter. Returns both addresses. owner is an argument rather than msg.sender, so a deploy helper can create on an artist's behalf; reverts OwnerRequired for a zero owner, FactoryDeprecated after deprecation, and FactoryPaused while paused. Token-side init reverts (RoyaltyTooHigh, RendererRequired) and minter-side init reverts (BadMintWindow, NotAContract for a codeless price strategy) surface through this call. On success, records the collection in isSurface/allSurfaces and emits SurfaceCreated naming the minter as primaryMinter.

solidity
(address collection, address minter) = factory.createSurface(
    "My Collection",
    "MC",
    artistAddress,
    cfg,     // SurfaceConfig: cap, royalty, renderer, locks
    sale,    // SaleConfig: price, window, payout, gates
    creators
);

createSurfaceCustom

solidity
function createSurfaceCustom(string name, string symbol, address owner, SurfaceConfig cfg, address[] initialMinters, address primaryMinter, address[] creators) external returns (address collection)

Access: permissionless (control belongs to the owner argument)

Deploys a sequential collection with no canonical minter: clones the token and initializes it with the caller's initialMinters (empty for collections that grant minters later) and a caller-chosen primaryMinter (the frontend-discovery default), which must be the zero address or a member of initialMinters, else PrimaryMinterNotAuthorized. For projects whose economics live in their own minter contract. Same creation gates as createSurface. Emits SurfaceCreated with the supplied primaryMinter (zero if none was chosen); the collection's owner can repoint it later with setPrimaryMinter. Minter grants beyond the initial set appear as MinterSet events on the collection.

createPooledSurface

solidity
function createPooledSurface(string name, string symbol, address owner, SurfaceConfig cfg, address[] initialMinters, address primaryMinter, address[] creators) external returns (address collection)

Access: permissionless (control belongs to the owner argument)

Deploys a pooled collection: the form where the minter chooses each id (tokenId == sourceId) and holds the pool's economics. Grant that minter in initialMinters so the collection deploys wired in one transaction; the pooled form holds one minter at a time, so more than one entry reverts TooManyMinters in the token's init. There is no canonical-minter form for pooled: a fixed-price pooled sale has no id-assignment policy a shared minter could apply. primaryMinter must be the zero address or the sole entry of initialMinters, else PrimaryMinterNotAuthorized; once set it tracks the pool's sole minter automatically and has no separate setter. Emits SurfaceCreated with the supplied primaryMinter (zero if none was chosen) and the pooled idMode.

deprecate

solidity
function deprecate(address successor_) external

Access: deployer-only (msg.sender must be the factory deployer, else NotDeployer)

One-way stop for new deploys: afterward every create function reverts FactoryDeprecated, and successor points to a replacement factory (zero if none is set). Deployed collections and minters are unaffected; the deployer has no power over them. Reverts AlreadyDeprecated on a second call. Emits Deprecated.

setPaused

solidity
function setPaused(bool paused_) external

Access: deployer-only (msg.sender must be the factory deployer, else NotDeployer)

Reversible pause on new deploys, separate from deprecate. While paused, the create functions revert FactoryPaused. A deprecated factory stays off regardless of this flag. Deployed collections are unaffected. Emits PausedSet.

Read functions

allSurfaces

solidity
function allSurfaces(uint256) external view returns (address)

Every collection address the factory has deployed, in deployment order. For direct onchain enumeration; indexers typically read SurfaceCreated.

catalog

solidity
function catalog() external view returns (address)

The Catalog singleton wired into every collection this factory creates, read to confirm creators (isConfirmedCreator). The Catalog is only read. Zero disables confirmation: a collection wired with no Catalog can list creators but confirms none.

bash
cast call 0xdB81d3F33EF3D84685486916E0d372E247558094 "catalog()(address)" \
  --rpc-url https://ethereum-rpc.publicnode.com

defaultRenderer

solidity
function defaultRenderer() external view returns (address)

The renderer a collection uses when its config names none. May be zero: with no factory default, a collection that names no renderer reverts RendererRequired at creation. A collection's owner can change its renderer after deploy; this is only the value new collections start with.

deployer

solidity
function deployer() external view returns (address)

The address that deployed the factory: the only address that may deprecate or setPaused. It has no power over deployed collections or minters.

deprecated

solidity
function deprecated() external view returns (bool)

True after the factory has been deprecated (new deploys revert).

isSurface

solidity
function isSurface(address) external view returns (bool)

Whether an address is a collection this factory deployed. Cheaper than scanning allSurfaces for a membership check.

minterImplementation

solidity
function minterImplementation() external view returns (address)

The FixedPriceMinter implementation createSurface clones. Fixed at construction, no setter. Not used by createSurfaceCustom or createPooledSurface, which take minters from the caller.

paused

solidity
function paused() external view returns (bool)

True while new deploys are paused (see setPaused). Reversible, unlike deprecated.

pooledImplementation

solidity
function pooledImplementation() external view returns (address)

The PooledSurface implementation every createPooledSurface clone delegates to. Fixed at construction, no setter.

sequentialImplementation

solidity
function sequentialImplementation() external view returns (address)

The sequential Surface implementation every createSurface and createSurfaceCustom clone delegates to. Fixed at construction, no setter.

successor

solidity
function successor() external view returns (address)

The replacement factory set at deprecation, or zero. Informational.

totalSurfaces

solidity
function totalSurfaces() external view returns (uint256)

The length of allSurfaces.

Events

Deprecated

solidity
event Deprecated(address indexed successor)

Emitted once when the deployer deprecates the factory, carrying the successor address (zero if none). Indexed by successor.

PausedSet

solidity
event PausedSet(bool paused)

Emitted when the deployer pauses or resumes new deploys, with the new paused state.

SurfaceCreated

solidity
event SurfaceCreated(address indexed owner, address indexed collection, address primaryMinter, IdMode idMode, string name, string symbol)

Emitted once per successful create call, with owner and collection indexed. primaryMinter is the chosen primary at creation: the canonical FixedPriceMinter clone createSurface wired, the caller's supplied primary on createSurfaceCustom/createPooledSurface, or address(0) when none was designated. This mirrors the collection's own primaryMinter() at creation time, the collection-to-minter binding an indexer reads first, but the collection's PrimaryMinterSet event is what keeps it current after a repoint, revoke-clear, or pooled sole-minter change. idMode records the form. It fires in the transaction that initializes the collection, so an indexer reading it can treat the collection and any wired minter as fully configured.

Errors

AlreadyDeprecated()

deprecate was called on an already-deprecated factory.

FactoryDeprecated()

A create function was called after deprecation. Deploy through the successor factory (successor()).

FactoryPaused()

A create function was called while the factory is paused (see setPaused).

FailedDeployment()

Inherited from OpenZeppelin Clones. The EIP-1167 clone deployment failed at the CREATE opcode. Not expected against a valid implementation.

InsufficientBalance(uint256 balance, uint256 needed)

Inherited from OpenZeppelin Clones. Raised by the value-forwarding clone variants when the factory's ETH balance is below the value being forwarded. The create functions do not forward value, so this is not reachable through the factory's public surface.

NotAContract(address account)

The constructor was given an address with no code where a contract is required: an implementation (sequential, pooled, or minter), a nonzero default renderer, or a nonzero Catalog.

NotDeployer()

deprecate or setPaused was called by an address other than the factory deployer.

OwnerRequired()

A create function was given the zero address as the collection owner.

PrimaryMinterNotAuthorized()

createSurfaceCustom or createPooledSurface was given a nonzero primaryMinter that is not a member of initialMinters (the sole entry, for the pooled form). The token's own initialize re-checks this independently of the factory.