Contract Engine CLI

Axicov CLI

Introduction

The Axicov Command Line Interface (CLI) is a powerful tool for blockchain developers that abstracts the complexity of Hardhat while enhancing developer experience. With intuitive commands and streamlined workflows, the Axicov CLI lets you focus on writing smart contracts rather than managing development infrastructure.

Installation

# Install globally using npm
npm install -g axicov-sdk

# Verify installation
axicov --version

Command Reference

Global Options

All Axicov commands support the following global options:

Option
Description

--help

Display help information

--version

Display version information

--config <path>

Specify custom config file location

--verbose

Enable verbose logging

axicov init

Initializes a new Axicov project with a well-structured development environment.

axicov init [options]

Options:

  • --name <name> - Project name (default: derived from current directory)

  • --template <template> - Project template (default: "hardhat")

  • --no-git - Skip Git initialization

  • --no-install - Skip dependency installation

Example:

# Interactive initialization
axicov init

# Non-interactive with specific options
axicov init --name MyTokenProject --template hardhat

Interactive Prompts:

  • Project Name

  • Dependency Selection (OpenZeppelin, Ethers.js, Thirdweb, etc.)

  • Network Configuration

  • AI Contract Recommendations

axicov generate

Generates smart contract templates based on standard patterns with customizable options.

axicov generate <type> [options]

Contract Types:

  • erc20 - ERC20 token contract

  • erc721 - NFT collection contract

  • dao - DAO governance contract

  • defi - DeFi protocol (with subtypes)

Options:

  • --name <name> - Contract name

  • --output <dir> - Output directory (default: "./contracts")

  • --force - Overwrite existing files

Example:

# Generate an ERC20 token interactively
axicov generate erc20

# Generate an NFT collection with specific name
axicov generate erc721 --name MyAwesomeNFT

axicov deploy

Compiles and deploys smart contracts to the specified network.

axicov deploy <contract> [options]

Options:

  • --network <network> - Target network (default: "sonicblaze")

  • --args <args> - Constructor arguments (comma-separated or JSON)

  • --gas-price <price> - Custom gas price (in gwei)

  • --gas-limit <limit> - Custom gas limit

  • --private-key <key> - Private key (overrides .env)

Example:

# Deploy to default network
axicov deploy MyToken

# Deploy to mainnet with constructor arguments
axicov deploy MyToken --network mainnet --args "My Token,MTK,1000000"

axicov test

Runs tests for your smart contracts using the Hardhat testing framework.

axicov test [pattern] [options]

Options:

  • --network <network> - Network to run tests on (default: "hardhat")

  • --grep <pattern> - Only run tests matching pattern

  • --gas - Report gas usage

  • --coverage - Generate coverage report

Example:

# Run all tests
axicov test

# Run specific test file
axicov test MyToken

# Run tests with gas reporting
axicov test --gas

axicov verify

Verifies contract source code on block explorers.

axicov verify <contract> [options]

Options:

  • --network <network> - Network where contract is deployed (default: "sonicblaze")

  • --address <address> - Contract address (optional if deployment info exists)

  • --args <args> - Constructor arguments (comma-separated or JSON)

  • --api-key <key> - Explorer API key (overrides .env)

Example:

# Verify using deployment information
axicov verify MyToken

# Verify with explicit address
axicov verify MyToken --address 0x123456789abcdef --network mainnet

Configuration

The Axicov CLI is configured through an axicov.config.ts file:

// Example axicov.config.ts
const axicovConfig = {
  projectName: "MyDeFiProject",
  defaultNetwork: "sonicblaze",
  aiRecommendations: true,
  contractsDir: "./contracts",
  buildDir: "./artifacts",
  testDir: "./test",
  networks: {
    sonicblaze: {
      url: "https://rpc.sonicblaze.io",
      chainId: 11155111,
      gasPrice: 20000000000,
      accounts: {
        mnemonic: process.env.MNEMONIC,
        path: "m/44'/60'/0'/0",
        initialIndex: 0,
        count: 10
      }
    },
    mainnet: {
      url: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
      accounts: [process.env.PRIVATE_KEY]
    }
  },
  solidity: {
    version: "0.8.17",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  }
};

export default axicovConfig;

Environment Variables

Store sensitive information in a .env file:

PRIVATE_KEY=your_wallet_private_key
INFURA_API_KEY=your_infura_api_key
ETHERSCAN_API_KEY=your_etherscan_api_key
MNEMONIC=your twelve word mnemonic phrase for development

CLI Output Control

Control the verbosity and format of CLI output:

# Enable verbose mode
axicov deploy MyToken --verbose

# JSON output for integration with other tools
axicov deploy MyToken --json > deployment.json

Advanced Usage

Custom Script Execution

Execute custom scripts in the context of your project:

axicov run scripts/custom-deployment.ts --network mainnet

Network Management

List and manage network configurations:

# List configured networks
axicov networks list

# Add a new network
axicov networks add arbitrum --url https://arb1.arbitrum.io/rpc --chain-id 42161

Plugin System

Extend Axicov with plugins:

# Install a plugin
axicov plugin add @axicov/gas-reporter

# Use plugin features

Last updated