cairo-erc1155
Generate ERC-1155 compliant smart contracts with customizable features like burnable, pausable, and mintable tokens. Source code is returned in Markdown format, ready for implementation without writing to disk.
Instructions
Make a non-fungible token per the ERC-1155 standard.
Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| access | No | The type of access control to provision. Ownable is a simple mechanism with a single account authorized for all privileged actions. Roles is a flexible mechanism with a separate role for each privileged action. A role can have many authorized accounts. | |
| baseUri | Yes | The location of the metadata for the token. Clients will replace any instance of {id} in this string with the tokenId. | |
| burnable | No | Whether token holders will be able to destroy their tokens | |
| info | No | Metadata about the contract and author | |
| mintable | No | Whether privileged accounts will be able to create more supply or emit more tokens | |
| name | Yes | The name of the contract | |
| pausable | No | Whether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response. | |
| royaltyInfo | No | Provides information for how much royalty is owed and to whom, based on a sale price. Follows ERC-2981 standard. | |
| updatableUri | No | Whether privileged accounts will be able to set a new URI for all token types. | |
| upgradeable | No | Whether the smart contract is upgradeable. |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"access": {
"description": "The type of access control to provision. Ownable is a simple mechanism with a single account authorized for all privileged actions. Roles is a flexible mechanism with a separate role for each privileged action. A role can have many authorized accounts.",
"enum": [
"ownable",
"roles"
],
"type": "string"
},
"baseUri": {
"description": "The location of the metadata for the token. Clients will replace any instance of {id} in this string with the tokenId.",
"type": "string"
},
"burnable": {
"description": "Whether token holders will be able to destroy their tokens",
"type": "boolean"
},
"info": {
"additionalProperties": false,
"description": "Metadata about the contract and author",
"properties": {
"license": {
"description": "The license used by the contract, default is \"MIT\"",
"type": "string"
},
"securityContact": {
"description": "Email where people can contact you to report security issues. Will only be visible if contract source code is verified.",
"type": "string"
}
},
"type": "object"
},
"mintable": {
"description": "Whether privileged accounts will be able to create more supply or emit more tokens",
"type": "boolean"
},
"name": {
"description": "The name of the contract",
"type": "string"
},
"pausable": {
"description": "Whether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response.",
"type": "boolean"
},
"royaltyInfo": {
"additionalProperties": false,
"description": "Provides information for how much royalty is owed and to whom, based on a sale price. Follows ERC-2981 standard.",
"properties": {
"defaultRoyaltyFraction": {
"description": "The royalty fraction that will be default for all tokens. It will be used for a token if there's no custom royalty fraction set for it.",
"type": "string"
},
"enabled": {
"description": "Whether to enable royalty feature for the contract",
"type": "boolean"
},
"feeDenominator": {
"description": "The denominator used to interpret a token's fee and to calculate the result fee fraction.",
"type": "string"
}
},
"required": [
"enabled",
"defaultRoyaltyFraction",
"feeDenominator"
],
"type": "object"
},
"updatableUri": {
"description": "Whether privileged accounts will be able to set a new URI for all token types.",
"type": "boolean"
},
"upgradeable": {
"description": "Whether the smart contract is upgradeable.",
"type": "boolean"
}
},
"required": [
"name",
"baseUri"
],
"type": "object"
}
Implementation Reference
- The asynchronous handler function that constructs ERC1155Options from input parameters and generates Cairo code using erc1155.print(opts), returning it as text content.async ({ name, baseUri, burnable, pausable, mintable, updatableUri, royaltyInfo, access, upgradeable, info }) => { const opts: ERC1155Options = { name, baseUri, burnable, pausable, mintable, updatableUri, royaltyInfo, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => erc1155.print(opts)), }, ], }; },
- Zod schema defining the input parameters for the cairo-erc1155 tool, including name, baseUri, optional flags like burnable, and common schema extensions.export const erc1155Schema = { name: z.string().describe(commonDescriptions.name), baseUri: z.string().describe(cairoERC1155Descriptions.baseUri), burnable: z.boolean().optional().describe(commonDescriptions.burnable), pausable: z.boolean().optional().describe(commonDescriptions.pausable), mintable: z.boolean().optional().describe(commonDescriptions.mintable), updatableUri: z.boolean().optional().describe(cairoERC1155Descriptions.updatableUri), royaltyInfo: z .object({ enabled: z.boolean().describe(cairoRoyaltyInfoDescriptions.enabled), defaultRoyaltyFraction: z.string().describe(cairoRoyaltyInfoDescriptions.defaultRoyaltyFraction), feeDenominator: z.string().describe(cairoRoyaltyInfoDescriptions.feeDenominator), }) .optional() .describe(cairoCommonDescriptions.royaltyInfo), ...commonSchema, } as const satisfies z.ZodRawShape;
- packages/mcp/src/cairo/tools/erc1155.ts:8-36 (registration)The registration function for the 'cairo-erc1155' tool, calling server.tool with name, prompt, schema, and handler.export function registerCairoERC1155(server: McpServer): RegisteredTool { return server.tool( 'cairo-erc1155', makeDetailedPrompt(cairoPrompts.ERC1155), erc1155Schema, async ({ name, baseUri, burnable, pausable, mintable, updatableUri, royaltyInfo, access, upgradeable, info }) => { const opts: ERC1155Options = { name, baseUri, burnable, pausable, mintable, updatableUri, royaltyInfo, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => erc1155.print(opts)), }, ], }; }, ); }