Skip to main content

Contract Reference

The Mirage app is wired to Base mainnet.

Addresses used by the app

ContractAddress
BpegFactory0x4E7E88485063EAAF29f92765D560055441893487
BpegRouter0x28E11E1cFAEfd85A51F1B5cAfA024847C2563857
BpegMarketplace0x1fADe40D92820d873ff9F710fE181d879e6B19AA
CCAT upeg contract0xD7800C338228a6eeb37cF74133732Fb6aE05915F
ClankerCats renderer0x2fE5bf2aB284bc71B261Ea6d32aaadfcA987Eeb8
ClankerCats ERC-7210xbE76Ce3cE0966fedA606fCF70884dae8FBaa7FCF
CLKCAT0x84a5637CcAC19250156e582c5bF7C01Eee151b07

Factory

BpegFactory deploys collections, owns protocol fee settings, and mints through authorized minters.

Key reads:

function owner() external view returns (address)
function treasury() external view returns (address)
function router() external view returns (address)
function mintFee() external view returns (uint256)
function discountFee() external view returns (uint256)
function superDiscountFee() external view returns (uint256)
function unlockFee() external view returns (uint256)
function feeFor(address minter) external view returns (uint256)
function collectionOf(address token) external view returns (address)
function collections(uint256 index) external view returns (address)
function totalCollections() external view returns (uint256)
function isMinter(address collection, address minter) external view returns (bool)
function isUnlocked(address collection) external view returns (bool)

Key writes:

function deploy(
address token,
address renderer,
uint256 maxSupply,
uint256 tokenThreshold,
uint16 royaltyBps,
string calldata name,
string calldata symbol
) external returns (address collection)

function mint(address collection, address to) external payable returns (uint256 tokenId)
function unlock(address collection) external payable
function setMinter(address collection, address minter, bool enabled) external

Router

BpegRouter is the collector-facing mint entry point.

function mint(address collection) external payable returns (uint256 tokenId)

function swapAndMint(
address tokenIn,
uint256 amountIn,
address swapRouter,
bytes calldata swapData,
address collection,
uint256 minOut
) external payable returns (uint256 tokenId)

function ethSwapAndMint(
address swapRouter,
bytes calldata swapData,
address collection,
uint256 minOut
) external payable returns (uint256 tokenId)

The current collection page uses the direct mint(collection) path.

Collection

Each bPeg collection is a standard ERC-721 deployed by the factory.

function name() external view returns (string memory)
function symbol() external view returns (string memory)
function totalSupply() external view returns (uint256)
function maxSupply() external view returns (uint256)
function token() external view returns (address)
function tokenThreshold() external view returns (uint256)
function royaltyBps() external view returns (uint16)
function creator() external view returns (address)
function ownerOf(uint256 tokenId) external view returns (address)
function tokenURI(uint256 tokenId) external view returns (string memory)
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external view returns (address receiver, uint256 royaltyAmount)

Renderer interface

Every Mirage renderer must implement:

function tokenURI(uint256 id, uint256 seed) external view returns (string memory)

The app expects the returned value to be a data URI containing JSON metadata and an image.

Trait storage

The launch wizard deploys BpegTraitStorage and uploads image data with:

function addTrait(
uint256 layerIndex,
string calldata name,
string calldata imageData,
uint256 weight
) external

The current wizard uses a single images layer for flat image collections.

Marketplace

BpegMarketplace supports native secondary sales:

function list(address collection, uint256 tokenId, uint256 price)
external returns (uint256 listingId)
function delist(uint256 listingId) external
function buy(uint256 listingId) external payable
function makeOffer(address collection, uint256 tokenId, uint256 expiry)
external payable returns (uint256 offerId)
function cancelOffer(uint256 offerId) external
function acceptOffer(uint256 offerId) external
function getFees(address collection, uint256 tokenId, uint256 price)
external view returns (uint256 protocolCut, uint256 royaltyCut, uint256 sellerCut)

ClankerCats reads

The staking surface checks ClankerCats eligibility with two read paths:

function OwnerUpegsCount(address owner) external view returns (uint256)
function balanceOf(address owner) external view returns (uint256)

The first read is against the CCAT upeg contract. The second read is against the ClankerCats ERC-721.