Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYesProgram name
symbolYesToken symbol, 2-5 chars
expiration_daysNoProgram 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 } }));
    },
  • 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 } }));
      },
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aspekt19/unboxed-loyalty-spark'

If you have feedback or need assistance with the MCP directory API, please join our Discord server