cairo-erc20
Generate ERC-20 token contracts for the Cairo language with customizable features like burnable tokens, pausable functionality, and voting capabilities.
Instructions
Make a fungible token per the ERC-20 standard.
Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the contract | |
| symbol | Yes | The short symbol for the token | |
| decimals | No | The number of decimals to use for the contract. Defaults to 18. | |
| burnable | No | Whether token holders will be able to destroy their tokens | |
| pausable | No | Whether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response. | |
| premint | No | The number of tokens to premint for the deployer. | |
| mintable | No | Whether privileged accounts will be able to create more supply or emit more tokens | |
| votes | No | Whether to keep track of historical balances for voting in on-chain governance, with a way to delegate one's voting power to a trusted account. | |
| appName | No | Required when votes is enabled, for hashing and signing typed structured data. Name for domain separator implementing SNIP12Metadata trait. Prevents two applications from producing the same hash. | |
| appVersion | No | Required when votes is enabled, for hashing and signing typed structured data. Version for domain separator implementing SNIP12Metadata trait. Prevents two versions of the same application from producing the same hash. | |
| 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. | |
| upgradeable | No | Whether the smart contract is upgradeable. | |
| info | No | Metadata about the contract and author |
Implementation Reference
- The tool handler function that takes ERC20 options, constructs ERC20Options using the input parameters, generates the Cairo ERC20 contract code using the OpenZeppelin wizard's erc20.print method, formats it safely, and returns it as MCP text content.async ({ name, symbol, decimals, burnable, pausable, premint, mintable, votes, appName, appVersion, access, upgradeable, info, }) => { const opts: ERC20Options = { name, symbol, decimals, burnable, pausable, premint, mintable, votes, appName, appVersion, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => erc20.print(opts)), }, ], }; },
- Zod schema defining and validating all input parameters for the cairo-erc20 tool, including name, symbol, decimals, extensions like burnable, pausable, etc., and common fields.export const erc20Schema = { name: z.string().describe(commonDescriptions.name), symbol: z.string().describe(commonDescriptions.symbol), decimals: z.string().optional().describe(cairoERC20Descriptions.decimals), burnable: z.boolean().optional().describe(commonDescriptions.burnable), pausable: z.boolean().optional().describe(commonDescriptions.pausable), premint: z.string().optional().describe(cairoERC20Descriptions.premint), mintable: z.boolean().optional().describe(commonDescriptions.mintable), votes: z.boolean().optional().describe(cairoERC20Descriptions.votes), appName: z.string().optional().describe(cairoCommonDescriptions.appName), appVersion: z.string().optional().describe(cairoCommonDescriptions.appVersion), ...commonSchema, } as const satisfies z.ZodRawShape;
- packages/mcp/src/cairo/tools/erc20.ts:8-53 (registration)Registration of the 'cairo-erc20' tool on the MCP server, including the tool name, detailed prompt from wizard-common, erc20Schema for input validation, and the handler function. This function is called from cairo/tools.ts during server setup.export function registerCairoERC20(server: McpServer): RegisteredTool { return server.tool( 'cairo-erc20', makeDetailedPrompt(cairoPrompts.ERC20), erc20Schema, async ({ name, symbol, decimals, burnable, pausable, premint, mintable, votes, appName, appVersion, access, upgradeable, info, }) => { const opts: ERC20Options = { name, symbol, decimals, burnable, pausable, premint, mintable, votes, appName, appVersion, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => erc20.print(opts)), }, ], }; }, ); }