stellar-stablecoin
Generate a stablecoin contract using the Fungible Token Standard, compatible with SEP-41. Customize features like burnability, pausability, minting, and access control. Outputs formatted source code in Markdown without saving to disk.
Instructions
Make a stablecoin that uses Fungible Token Standard, compatible with SEP-41.
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. | |
| burnable | No | Whether token holders will be able to destroy their tokens | |
| info | No | Metadata about the contract and author | |
| limitations | No | Whether to restrict certain users from transferring tokens, either via allowing or blocking them. | |
| 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. | |
| premint | No | The number of tokens to premint for the deployer. | |
| symbol | Yes | The short symbol for the token | |
| upgradeable | No | Whether the contract can be upgraded. |
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"
},
"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"
},
"limitations": {
"anyOf": [
{
"enum": [
false,
"allowlist"
],
"type": [
"boolean",
"string"
]
},
{
"const": "blocklist",
"type": "string"
}
],
"description": "Whether to restrict certain users from transferring tokens, either via allowing or blocking them."
},
"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"
},
"premint": {
"description": "The number of tokens to premint for the deployer.",
"type": "string"
},
"symbol": {
"description": "The short symbol for the token",
"type": "string"
},
"upgradeable": {
"description": "Whether the contract can be upgraded.",
"type": "boolean"
}
},
"required": [
"name",
"symbol"
],
"type": "object"
}
Implementation Reference
- The handler function for the 'stellar-stablecoin' tool. It constructs StablecoinOptions from input parameters and generates Rust source code using stablecoin.print(opts) from '@openzeppelin/wizard-stellar', wrapped in a markdown code block.async ({ name, symbol, burnable, pausable, premint, mintable, upgradeable, access, limitations, info }) => { const opts: StablecoinOptions = { name, symbol, burnable, pausable, premint, mintable, upgradeable, access, limitations, info, }; return { content: [ { type: 'text', text: safePrintRustCodeBlock(() => stablecoin.print(opts)), }, ], }; },
- Zod schema for validating input parameters to the stellar-stablecoin tool, extending fungibleSchema with limitations option.export const stablecoinSchema = { ...fungibleSchema, limitations: z .literal(false) .or(z.literal('allowlist')) .or(z.literal('blocklist')) .optional() .describe(stellarStablecoinDescriptions.limitations), } as const satisfies z.ZodRawShape;
- packages/mcp/src/stellar/tools/stablecoin.ts:8-36 (registration)Registration function for the 'stellar-stablecoin' tool, called during server setup. Registers the tool name, prompt, schema, and handler with the MCP server.export function registerStellarStablecoin(server: McpServer): RegisteredTool { return server.tool( 'stellar-stablecoin', makeDetailedPrompt(stellarPrompts.Stablecoin), stablecoinSchema, async ({ name, symbol, burnable, pausable, premint, mintable, upgradeable, access, limitations, info }) => { const opts: StablecoinOptions = { name, symbol, burnable, pausable, premint, mintable, upgradeable, access, limitations, info, }; return { content: [ { type: 'text', text: safePrintRustCodeBlock(() => stablecoin.print(opts)), }, ], }; }, ); }
- packages/mcp/src/utils.ts:47-49 (helper)Helper function used in the handler to safely print the generated Rust code in a markdown block with syntax highlighting, handling errors gracefully.export function safePrintRustCodeBlock(printFn: () => string): string { return safePrintCodeBlock(printFn, 'rust'); }
- packages/mcp/src/server.ts:27-27 (registration)Top-level call to register all Stellar tools, including 'stellar-stablecoin', during MCP server creation.registerStellarTools(server);