Skip to main content

Custom Contract

Most of the time artist can deploy Verse contract with one click using our UI, however if you'd like to write your own contract that is also possible. The only requirements are:

  • implement mint method (since Verse performs minting on behalf of the user)
  • grant Verse wallet permission to call mint method

Delegated minting can be implemented in a similar way as shown below.

address public mintingManager;

modifier onlyMinter() {
require(msg.sender == mintingManager);
_;
}

function mint(address to, uint256 tokenId) public onlyMinter {
// your custom implementation
}

function mintBatch(address[] memory to, uint256[] memory tokenIds) public onlyMinter {
// your custom implementation
}

Minting Manager

The mintingManager address must be set to the Verse wallet so that Verse can mint on behalf of the user. Use the following addresses depending on the network:

  • Base mainnet (for testing): 0x212677d771871A31d40706D52446D664B51ca1A5
  • Ethereum mainnet: 0xe445Fb0297F7D1f507dF708185946210eB6a9DE6

Token ID Generation

Since Verse decides token ids, you can choose one of the following strategies for how token ids are generated. Let us know which option you prefer:

  1. Random uint256 token ids — a fully random large integer is generated for every token (e.g. 4488483939393939395554). This is useful if you want true randomness so you can derive the output from the token id.
  2. Serial token ids starting from X — sequential ids (e.g. 0, 1, 2, 3, …) assigned to each new mint. Works when your output does not depend on the token id at all.
  3. Random token ids in a range — any integer within a fixed range, e.g. [1, 100]. Works well if you have a preset of 100 outputs and want them distributed randomly among mints.
  4. Pre-defined CSV mapping — you provide a CSV of options and users can pick which token gets minted. Good if you want users to choose from a predefined list of outputs. This option only works for Artist Curated projects. The CSV must include a $custom_token_id column which will be mapped to the actual on-chain token id at mint time (each $custom_token_id must be unique).

Note: When using any of the last three options (i.e. anything other than fully random uint256 token ids), only Verse should perform the actual mints. Otherwise, minting can get stuck — for example, if Verse mints token 10 and the artist independently mints token 11 outside of Verse, Verse will still attempt to mint token 11 for the next mint and fail.

Verse will display the art based on the data returned in tokenURI.