cairo-vesting
Generate vesting smart contracts for ERC-20 tokens with predefined schedules. Specify start date, duration, cliff period, and vesting type to create contract source code formatted in Markdown.
Instructions
Make a vesting smart contract that manages the gradual release of ERC-20 tokens to a designated beneficiary based on a predefined vesting schedule.
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 |
|---|---|---|---|
| cliffDuration | Yes | The duration of the cliff period. Must be less than or equal to the total duration. In readable date time format matching /^(\d+(?:\.\d+)?) +(second|minute|hour|day|week|month|year)s?$/ | |
| duration | Yes | The total duration of the vesting period. In readable date time format matching /^(\d+(?:\.\d+)?) +(second|minute|hour|day|week|month|year)s?$/ | |
| info | No | Metadata about the contract and author | |
| name | Yes | The name of the contract | |
| schedule | Yes | A vesting schedule implementation, tokens can either be vested gradually following a linear curve or with custom vesting schedule that requires the implementation of the VestingSchedule trait. | |
| startDate | Yes | The timestamp marking the beginning of the vesting period. In HTML input datetime-local format |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"cliffDuration": {
"description": "The duration of the cliff period. Must be less than or equal to the total duration. In readable date time format matching /^(\\d+(?:\\.\\d+)?) +(second|minute|hour|day|week|month|year)s?$/",
"type": "string"
},
"duration": {
"description": "The total duration of the vesting period. In readable date time format matching /^(\\d+(?:\\.\\d+)?) +(second|minute|hour|day|week|month|year)s?$/",
"type": "string"
},
"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"
},
"name": {
"description": "The name of the contract",
"type": "string"
},
"schedule": {
"description": "A vesting schedule implementation, tokens can either be vested gradually following a linear curve or with custom vesting schedule that requires the implementation of the VestingSchedule trait.",
"enum": [
"linear",
"custom"
],
"type": "string"
},
"startDate": {
"description": "The timestamp marking the beginning of the vesting period. In HTML input datetime-local format",
"type": "string"
}
},
"required": [
"name",
"startDate",
"duration",
"cliffDuration",
"schedule"
],
"type": "object"
}
Implementation Reference
- The handler function for the 'cairo-vesting' tool. It constructs VestingOptions from input parameters and generates Cairo vesting contract code using vesting.print(opts) from @openzeppelin/wizard-cairo.async ({ name, startDate, duration, cliffDuration, schedule, info }) => { const opts: VestingOptions = { name, startDate, duration, cliffDuration, schedule, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => vesting.print(opts)), }, ], }; },
- Zod schema defining the input shape for the 'cairo-vesting' tool, including name, dates, duration, cliff, schedule, and info.export const vestingSchema = { name: z.string().describe(commonDescriptions.name), startDate: z.string().describe(cairoVestingDescriptions.startDate), duration: z.string().describe(cairoVestingDescriptions.duration), cliffDuration: z.string().describe(cairoVestingDescriptions.cliffDuration), schedule: z.enum(['linear', 'custom']).describe(cairoVestingDescriptions.schedule), info: commonSchema.info, } as const satisfies z.ZodRawShape;
- packages/mcp/src/cairo/tools/vesting.ts:8-32 (registration)Registration function for the 'cairo-vesting' tool, called from tools.ts. Registers the tool with MCP server using server.tool, specifying the name 'cairo-vesting', prompt, schema, and handler.export function registerCairoVesting(server: McpServer): RegisteredTool { return server.tool( 'cairo-vesting', makeDetailedPrompt(cairoPrompts.Vesting), vestingSchema, async ({ name, startDate, duration, cliffDuration, schedule, info }) => { const opts: VestingOptions = { name, startDate, duration, cliffDuration, schedule, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => vesting.print(opts)), }, ], }; }, ); }
- packages/mcp/src/cairo/tools.ts:30-34 (registration)Top-level registration function that registers all Cairo tools, including vesting by calling registerCairoVesting(server).export function registerCairoTools(server: McpServer) { Object.values(getRegisterFunctions(server)).forEach(registerTool => { registerTool(server); }); }