Docs menu

Interfaces

The Solidity interfaces in src/interfaces/ of the repository, and the ERC-165 ids Shapes and its periphery answer. An interface id is the XOR of the selectors of the functions the interface itself declares, excluding inherited ones, which is what type(I).interfaceId returns.

On the Shapes token

Shapes.supportsInterface(id) returns true for every id below.

InterfaceIdMembers
IERC1650x01ffc9a7supportsInterface
IERC7210x80ac58cdStandard ERC-721
IERC721Metadata0x5b5e139fname, symbol, tokenURI
IERC29810x2a55205aroyaltyInfo, always zero
ERC-49060x49064906MetadataUpdate, BatchMetadataUpdate
IERC721Value0x88495fe7valueOf, burn (draft ERC-8060)
IAdminControl0x0ce8a022admin, transferAdmin, renounceAdmin, setFeeRecipient, setMintFee
IShapeValue0xd07d718abackingOf, denomIndexOf, denominationAt, denominationCount, unit, redeem, redeemBatch, redeemTo, redeemBatchTo
IShapeRecomposition0xec6e0ab9compose, decompose, decomposeTo, split, splitTo, burnBacking
IShapeProvenance0x32b56359seedOf, originCountOf, inkGeneOf, isComplete, formationOf, childSeed
IShapes0xa43afc62The full surface: 92 functions, every event and error

IShapes extends IERC721, IERC721Value and IAdminControl. The three slices, IShapeValue, IShapeRecomposition and IShapeProvenance, are declared in IShapes.sol for an integrator that needs only part of the surface; every member is implemented on the token.

On the periphery

InterfaceIdAnswered byPurpose
IShapeRenderer0xefb4cd24renderer()renderSVG, renderSVGSampled, metadataJSON, metadataJSONSampled and the rest of the pure rendering surface
IShapeGeometry0xfefff92frenderer()grammarVersion, grammarHash, cardGeometry, cardGeometrySampled, moduleAt, moduleAtSampled
IShapeCollection0x8d32a84bcollection()Metadata copy, contractURI, json, image, imageFor, card, cardFor, seed
IShapePositionResolver0x46f96023positions().targetpositionOf
IShapeAuctionHouse0x4dec63f0market().targetThe auction house

setRenderer requires IShapeRenderer and IShapeGeometry; setCollection requires IShapeCollection; setPointer requires IShapePositionResolver or IShapeAuctionHouse for the respective slot.

Types

src/ShapeTypes.sol declares the shared types:

enum ShapeFormation { Fragment, Direct, Composed, Complete, Black }

struct ShapeState {
    bytes32 seed; uint8 denominationIndex; uint32 originCount; uint8 inkGene; bool isBlack;
    ShapeFormation formation; uint256 faceValueWei; uint256 redeemableValueWei; bytes modules;
}

struct ShapeChildPreview {
    bytes32 seed; uint8 denominationIndex; uint32 originCount; uint8 inkGene;
    uint256 faceValueWei; bytes modules;
}

struct ComposeInputView {
    uint256 id; bytes32 seed; uint8 denominationIndex; uint32 originCount; uint8 inkGene; bytes modules;
}

struct ComposeRecordView {
    uint8 survivorDenominationIndex; uint32 survivorOriginCount; uint8 survivorInkGene;
    bytes survivorModules; uint256 ownerTokenFrom; ComposeInputView[] inputs;
}

IShapes.Pointer is { Positions, Market }, passed to setPointer and lockPointer as uint8 0 or 1. IShapes.ComposeCall is { uint256 survivorId; uint256[] burnIds; } for composeMany.

Using the interfaces

Copy IShapes.sol, ShapeTypes.sol, IERC721Value.sol and IAdminControl.sol from the repository into your project (they import OpenZeppelin's IERC721), or declare a minimal interface with only the functions you call. The full ABI is in deployments/1.json and the Contracts page.