Skip to main content
Glama

deploy-mon-contract

Deploy smart contracts on the Monad testnet by providing contract bytecode, ABI, and constructor arguments, enabling integration and testing on the blockchain.

Instructions

Deploy a smart contract on Monad testnet

Input Schema

NameRequiredDescriptionDefault
abiYesContract ABI
bytecodeYesContract bytecode
constructorArgsNoConstructor arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "abi": { "description": "Contract ABI", "type": "string" }, "bytecode": { "description": "Contract bytecode", "type": "string" }, "constructorArgs": { "description": "Constructor arguments", "type": "array" } }, "required": [ "bytecode", "abi" ], "type": "object" }

Implementation Reference

  • The handler function that executes the deployment of a smart contract on Monad testnet using viem wallet client.
    async ({ bytecode, abi, constructorArgs }) => { try { // Create wallet client const client = await createWallet(); // Deploy contract const hash = await client.deployContract({ abi: JSON.parse(abi), bytecode: bytecode as `0x${string}`, args: constructorArgs || [], }); return { content: [ { type: "text", text: `Contract deployment transaction sent! Hash: ${hash}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to deploy contract. Error: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );
  • Zod input schema defining parameters for contract deployment: bytecode, ABI, and optional constructor arguments.
    { bytecode: z.string().describe("Contract bytecode"), abi: z.string().describe("Contract ABI"), constructorArgs: z.array(z.any()).optional().describe("Constructor arguments"), },
  • Core registration of the 'deploy-mon-contract' tool using server.tool(), specifying name, description, input schema, and handler function.
    server.tool( "deploy-mon-contract", "Deploy a smart contract on Monad testnet", { bytecode: z.string().describe("Contract bytecode"), abi: z.string().describe("Contract ABI"), constructorArgs: z.array(z.any()).optional().describe("Constructor arguments"), }, async ({ bytecode, abi, constructorArgs }) => { try { // Create wallet client const client = await createWallet(); // Deploy contract const hash = await client.deployContract({ abi: JSON.parse(abi), bytecode: bytecode as `0x${string}`, args: constructorArgs || [], }); return { content: [ { type: "text", text: `Contract deployment transaction sent! Hash: ${hash}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to deploy contract. Error: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );
  • Invocation of deployContractProvider within the contractProvider helper to register contract tools.
    deployContractProvider(server); contractEventProvider(server);
  • Invocation of contractProvider in main server initialization to register all contract tools including deploy-mon-contract.
    contractProvider(server);

Other Tools

Related Tools

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/lispking/monad-mcp-server'

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