Skip to main content
Glama

write.asset_manager.compounder_staked

Read-onlyIdempotent

Claim staking rewards from LP positions, swap them to a target token via CowSwap, and compound back into the position in a single transaction.

Instructions

Encode args for compounder coupled with CowSwap for staked LP positions (e.g. staked Slipstream/Aerodrome). Staked positions earn staking emission rewards (e.g. AERO, OP, or any configured emission token) — not LP fees. Claims these staking rewards, swaps them to a target token via CowSwap batch auctions (MEV-protected), then compounds back into the LP position. Sets metadata on BOTH the CowSwapper and the Compounder in a single call. sell_tokens is the list of reward token addresses (e.g. [AERO_address]). buy_token should be a major token in the pair (USDC, WETH, cbBTC). Returns { asset_managers, statuses, datas } with 2 entries (cowswapper + compounder). Base only. Combinable with other intent tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dex_protocolYesDEX protocol of the LP position — used to resolve the correct asset manager address.
sell_tokensYesToken addresses to sell via CowSwap (typically [AERO] for staked positions)
buy_tokenYesToken address to buy — should be a major token in the pair (USDC, WETH, cbBTC)
enabledNoTrue to enable, false to disable
chain_idNoChain ID: 8453 (Base) or 130 (Unichain)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasYes
statusesYes
descriptionNo
strategy_nameNo
asset_managersYes

Implementation Reference

  • The registration and handler implementation for the tool "write.asset_manager.compounder_staked", which encodes arguments for a compounder coupled with CowSwap for staked LP positions.
    server.registerTool(
      "write.asset_manager.compounder_staked",
      {
        annotations: {
          title: "Encode Compounder + CowSwap Automation",
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
        description:
          "Encode args for compounder coupled with CowSwap for staked LP positions (e.g. staked Slipstream/Aerodrome). Staked positions earn staking emission rewards (e.g. AERO, OP, or any configured emission token) — not LP fees. Claims these staking rewards, swaps them to a target token via CowSwap batch auctions (MEV-protected), then compounds back into the LP position. Sets metadata on BOTH the CowSwapper and the Compounder in a single call. sell_tokens is the list of reward token addresses (e.g. [AERO_address]). buy_token should be a major token in the pair (USDC, WETH, cbBTC). Returns { asset_managers, statuses, datas } with 2 entries (cowswapper + compounder). Base only. Combinable with other intent tools.",
        outputSchema: IntentOutput,
        inputSchema: {
          dex_protocol: DEX_PROTOCOL_SCHEMA,
          sell_tokens: z
            .array(z.string())
            .describe("Token addresses to sell via CowSwap (typically [AERO] for staked positions)"),
          buy_token: z
            .string()
            .describe(
              "Token address to buy — should be a major token in the pair (USDC, WETH, cbBTC)",
            ),
          enabled: z.boolean().default(true).describe("True to enable, false to disable"),
          chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
        },
      },
      async (params) => {
        try {
          const validChainId = validateChainId(params.chain_id);
          const amKey = dexProtocolToAmKey(params.dex_protocol);
          let cowSwapperAddress: string;
          try {
            cowSwapperAddress = getStandaloneAmAddress(validChainId, "cowSwapper");
          } catch {
            throw new Error(
              `compounder_staked is not available on chain ${validChainId} because it requires cow_swapper, which is Base-only (8453).`,
            );
          }
          const compounderAddress = getAmProtocolAddress(validChainId, "compounders", amKey);
    
          if (!params.enabled) {
            return formatResult(
              disabledIntent(
                [cowSwapperAddress, compounderAddress],
                `Disable compounder_staked (${params.dex_protocol})`,
              ),
            );
          }
    
          const validSellTokens = params.sell_tokens.map((t, i) =>
            validateAddress(t, `sell_tokens[${i}]`),
          );
          const validBuyToken = validateAddress(params.buy_token, "buy_token");
    
          const cowSwapperData = encodeCowSwapTokenMetadata(
            "cow_swap_compound",
            validSellTokens,
            validBuyToken,
          );
    
          const compounderData = encodeCompounderCoupledCallbackData(
            COWSWAPPER_INITIATOR,
            "cow_swap_compound",
          );
    
          const result = {
            description: `Enable compounder_staked (${params.dex_protocol}, cowswap)`,
            asset_managers: [cowSwapperAddress, compounderAddress],
            statuses: [true, true],
            datas: [cowSwapperData, compounderData],
          };
          return formatResult(result);
        } catch (err) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error: ${err instanceof Error ? err.message : String(err)}`,
              },
            ],
            isError: true,
          };
        }
      },
    );

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/arcadia-finance/arcadia-finance-mcp-server'

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