IRenderer

Interface (ABI only), not a deployed contract. Implement it to install a custom renderer in the renderer slot.

IRenderer is the interface a contract implements to occupy a collection's renderer slot, the token's one swappable presentation slot (see slots and modules) on the Surface core. A collection's tokenURI and contractURI delegate to whatever renderer sits in its renderer slot. The collection address is an explicit parameter on both functions rather than msg.sender, so a single renderer instance serves every collection that adopts it, an offchain caller can eth_call it directly for any collection without a transaction, and any contract can adopt a given renderer when it exposes the reads that renderer actually uses. ISurfaceView is the V1 read shape; current V2 has different configuration and minter selectors.

Renderers are onchain views with full EVM read access: a token's seed, its owner, sibling tokens on the same collection, companion contract state, other contracts, and current block state. A renderer's output can therefore depend on live chain state, not only on data written at mint time. See the write a renderer guide for version-specific read interfaces.

Read functions

contractURI

solidity
function contractURI(address collection) external view returns (string)

view; returns the collection-level metadata URI for collection. Called by the collection's own contractURI when this renderer occupies its renderer slot. Marketplaces and indexers read this for collection-level display metadata, separate from any individual token's tokenURI.

tokenURI

solidity
function tokenURI(address collection, uint256 tokenId) external view returns (string)

view; returns the metadata URI for tokenId on collection. Called by the collection's own tokenURI when this renderer occupies its renderer slot, and callable directly offchain against any collection this renderer supports. Implementations read the collection through the appropriate V1 or current V2 ABI. Use tokenSeed, ownership, and any other inputs required by the artwork; do not decode current V2 config() as the V1 struct.