create_loyalty_program
Deploy ERC-20 loyalty tokens on Base L2 by generating factory calldata for new loyalty programs with customizable names, symbols, and durations.
Instructions
Get factory calldata to deploy a new ERC-20 loyalty token on Base
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Program name | |
| symbol | Yes | Token symbol, 2-5 chars | |
| expiration_days | No | Program duration in days (default: 365) |
Implementation Reference
- The handler implementation for the 'create_loyalty_program' MCP tool, which prepares the calldata for deploying a loyalty token.
handler: async ({ name, symbol, expiration_days }: any) => { const err = authGuard(["mint", "create_program"]); if (err) return T(err); const days = expiration_days || 365; const sym = symbol.toUpperCase(); const calldata = encodeCreateLoyaltyTokenCalldata(name, sym, agent.ownerAddress); return T(JSON.stringify({ message: "Execute factory tx, then call register_loyalty_program with the deployed token_address.", contract_call: { to: FACTORY_ADDRESS, function: "createLoyaltyToken(string,string,address)", params: [name, sym, agent.ownerAddress], calldata, chain: "Base (8453)", builder_code: BUILDER_CODE }, program_details: { name, symbol: sym, expiration_days: days } })); }, - supabase/functions/loyalty-mcp/index.ts:52-63 (registration)Tool registration for 'create_loyalty_program'.
mcpServer.tool("create_loyalty_program", { description: "Get factory calldata to deploy a new ERC-20 loyalty token on Base", inputSchema: { type: "object" as const, properties: { name: { type: "string", description: "Program name" }, symbol: { type: "string", description: "Token symbol, 2-5 chars" }, expiration_days: { type: "number", description: "Program duration in days (default: 365)" } }, required: ["name", "symbol"] }, handler: async ({ name, symbol, expiration_days }: any) => { const err = authGuard(["mint", "create_program"]); if (err) return T(err); const days = expiration_days || 365; const sym = symbol.toUpperCase(); const calldata = encodeCreateLoyaltyTokenCalldata(name, sym, agent.ownerAddress); return T(JSON.stringify({ message: "Execute factory tx, then call register_loyalty_program with the deployed token_address.", contract_call: { to: FACTORY_ADDRESS, function: "createLoyaltyToken(string,string,address)", params: [name, sym, agent.ownerAddress], calldata, chain: "Base (8453)", builder_code: BUILDER_CODE }, program_details: { name, symbol: sym, expiration_days: days } })); }, });