stylus-erc20
Generate ERC-20 compliant smart contract source code with customizable features like burnable tokens, flash loans, and permit functionality, formatted in Markdown. No disk writes are performed.
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 |
|---|---|---|---|
| burnable | No | Whether token holders will be able to destroy their tokens | |
| flashmint | No | Whether to include built-in flash loans to allow lending tokens without requiring collateral as long as they're returned in the same transaction. | |
| info | No | Metadata about the contract and author | |
| name | Yes | The name of the contract | |
| permit | No | Whether without paying gas, token holders will be able to allow third parties to transfer from their account. |
Implementation Reference
- The handler function that executes the 'stylus-erc20' tool. It constructs ERC20Options from inputs and generates Rust code for the Stylus ERC20 contract using erc20.print().async ({ name, burnable, permit, flashmint, info }) => { const opts: ERC20Options = { name, burnable, permit, flashmint, info, }; return { content: [ { type: 'text', text: safePrintRustCodeBlock(() => erc20.print(opts)), }, ], }; },
- Zod schema for input validation of the 'stylus-erc20' tool parameters (name, burnable, permit, flashmint, info).export const erc20Schema = { name: z.string().describe(commonDescriptions.name), burnable: z.boolean().optional().describe(commonDescriptions.burnable), permit: z.boolean().optional().describe(stylusERC20Descriptions.permit), flashmint: z.boolean().optional().describe(stylusERC20Descriptions.flashmint), ...commonSchema, } as const satisfies z.ZodRawShape;
- packages/mcp/src/stylus/tools/erc20.ts:8-31 (registration)Registration of the 'stylus-erc20' tool on the MCP server, specifying name, prompt, schema, and handler function.export function registerStylusERC20(server: McpServer): RegisteredTool { return server.tool( 'stylus-erc20', makeDetailedPrompt(stylusPrompts.ERC20), erc20Schema, async ({ name, burnable, permit, flashmint, info }) => { const opts: ERC20Options = { name, burnable, permit, flashmint, info, }; return { content: [ { type: 'text', text: safePrintRustCodeBlock(() => erc20.print(opts)), }, ], }; }, ); }