Skip to main content
Glama

activate_loyalty_program

Activate an inactive loyalty program by generating calldata to unpause utility and enable token minting for a specified token contract.

Instructions

Get activation calldata (unpauseUtility + enableMinting) for an inactive program

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address (0x...)

Implementation Reference

  • The handler for activate_loyalty_program which checks authentication, verifies program status in the database, and returns the necessary on-chain transaction calldata.
    handler: async ({ token_address }: any) => {
      const err = authGuard(["mint", "create_program"]);
      if (err) return T(err);
      const d = db();
      const { data: prog } = await d.from("loyalty_programs").select("id,name,symbol,status").eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress).single();
      if (!prog) return T('{"error":"Program not found"}');
      if (prog.status === "active") return T(JSON.stringify({ message: "Already active", program: prog }));
      return T(JSON.stringify({ message: "Execute 2 transactions in order, then call update_program_status to set status to 'active'.", transactions: [
        { step: 1, description: "Unpause utility", contract_call: { to: token_address, function: "unpauseUtility()", calldata: encodeNoArgCalldata(SELECTORS.unpauseUtility), chain: "Base (8453)", builder_code: BUILDER_CODE } },
        { step: 2, description: "Enable minting", contract_call: { to: token_address, function: "enableMinting()", calldata: encodeNoArgCalldata(SELECTORS.enableMinting), chain: "Base (8453)", builder_code: BUILDER_CODE } },
      ] }));
    },
  • Registration of the activate_loyalty_program MCP tool.
    mcpServer.tool("activate_loyalty_program", {
      description: "Get activation calldata (unpauseUtility + enableMinting) for an inactive program",
      inputSchema: { type: "object" as const, properties: { token_address: { type: "string", description: "Token contract address (0x...)" } }, required: ["token_address"] },
      handler: async ({ token_address }: any) => {
        const err = authGuard(["mint", "create_program"]);
        if (err) return T(err);
        const d = db();
        const { data: prog } = await d.from("loyalty_programs").select("id,name,symbol,status").eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress).single();
        if (!prog) return T('{"error":"Program not found"}');
        if (prog.status === "active") return T(JSON.stringify({ message: "Already active", program: prog }));
        return T(JSON.stringify({ message: "Execute 2 transactions in order, then call update_program_status to set status to 'active'.", transactions: [
          { step: 1, description: "Unpause utility", contract_call: { to: token_address, function: "unpauseUtility()", calldata: encodeNoArgCalldata(SELECTORS.unpauseUtility), chain: "Base (8453)", builder_code: BUILDER_CODE } },
          { step: 2, description: "Enable minting", contract_call: { to: token_address, function: "enableMinting()", calldata: encodeNoArgCalldata(SELECTORS.enableMinting), chain: "Base (8453)", builder_code: BUILDER_CODE } },
        ] }));
      },
    });

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