Key Concepts

Axicov simplifies blockchain development by applying well-established patterns and practices. This section covers the fundamental concepts that underpin development with the Axicov SDK.

Project Architecture

Standard Project Structure

Axicov organizes projects following a consistent directory structure:

MyProject/
├── contracts/           # Smart contract source files
│   ├── interfaces/      # Contract interfaces
│   ├── libraries/       # Reusable libraries
│   └── test/            # Mock contracts for testing
├── scripts/             # Deployment and operational scripts
├── test/                # Test files
├── artifacts/           # Compiled contract artifacts
├── deployments/         # Deployment records by network
├── .env                 # Environment variables
├── .gitignore           # Git ignore configuration
├── axicov.config.ts     # Axicov configuration
├── hardhat.config.ts    # Generated Hardhat configuration
└── package.json         # Project dependencies

Configuration Management

Axicov uses a layered configuration approach:

  1. Defaults - Sensible defaults for all settings

  2. axicov.config.ts - Project-specific overrides

  3. Environment Variables - Sensitive or environment-specific values

  4. Command Line Arguments - Runtime overrides

This allows for flexible configuration that adapts to different environments and use cases.

Development Workflow

The Axicov Development Lifecycle

Development Lifecycle
  1. Initialize - Set up project structure and dependencies

  2. Generate - Create contract templates

  3. Develop - Customize contracts and write tests

  4. Test - Verify contract functionality

  5. Deploy - Push contracts to the blockchain

  6. Verify - Publish source code on block explorers

  7. Monitor - Track contract performance and usage

Version Control Integration

Axicov automatically configures .gitignore for blockchain projects and supports Git-based workflows:

# Create a feature branch
git checkout -b feature/new-token

# Make changes to contracts and tests
axicov generate erc20 --name NewToken

# Test changes
axicov test

# Commit changes
git add .
git commit -m "Add NewToken implementation"

# Merge to main branch when ready
git checkout main
git merge feature/new-token

Smart Contract Paradigms

Contract Design Patterns

Axicov templates implement established design patterns:

  • Ownable - Restricted access to administrative functions

  • Pausable - Emergency stop mechanism

  • Role-Based Access Control - Granular permissions

  • Proxy Patterns - Upgradeable contracts

  • Factory Pattern - Dynamic contract creation

  • Checks-Effects-Interactions - Reentrancy protection

Modularity and Composability

Axicov encourages building contracts from reusable components:

// Example of composable contract inheritance
contract MyToken is ERC20, ERC20Burnable, Pausable, Ownable {
    // Implementation combines functionality from multiple base contracts
}

This approach promotes:

  • Code reuse

  • Simplified auditing

  • Established security patterns

  • Interoperability with other protocols

Network Management

Supported Networks

Axicov provides pre-configured support for:

Network
Type
ChainID
Description

Sonic Blaze

Testnet

11155111

Default development testnet

Ethereum

Mainnet

1

Production Ethereum network

Goerli

Testnet

5

Ethereum testnet

Polygon

Mainnet

137

Production Polygon network

Mumbai

Testnet

80001

Polygon testnet

Arbitrum

Mainnet

42161

Production Arbitrum network

Optimism

Mainnet

10

Production Optimism network

Network Configuration

Networks can be configured in axicov.config.ts:

networks: {
  sonicblaze: {
    url: "https://rpc.sonicblaze.io",
    chainId: 11155111,
    accounts: [process.env.PRIVATE_KEY],
    gasPrice: 20000000000
  },
  custom: {
    url: "https://my-network-rpc.com",
    chainId: 12345,
    accounts: {
      mnemonic: process.env.MNEMONIC,
      path: "m/44'/60'/0'/0",
      initialIndex: 0,
      count: 10
    }
  }
}

Security Considerations

Automated Security Practices

Axicov implements security best practices by default:

  • SWC Registry - Checks for known vulnerabilities

  • Solidity Style Guide - Enforces coding standards

  • Gas Optimization - Identifies inefficient patterns

  • Formal Verification - Option for critical contracts

Audit Preparation

Prepare contracts for professional audits:

# Generate documentation
axicov docs generate

# Run comprehensive tests with gas reporting
axicov test --coverage --gas

# Check for known vulnerabilities
axicov security scan

Deployment Strategies

Progressive Deployment

For complex systems, Axicov supports staged deployments:

  1. Core Contracts - Deploy fundamental components

  2. Peripheral Contracts - Deploy supporting contracts

  3. Integration - Connect contracts together

  4. Validation - Verify full system functionality

  5. Access Control - Transfer ownership to final addresses

Deployment Records

Axicov maintains detailed deployment records by network:

{
  "MyToken": {
    "address": "0x8B45D5A8617E980C9cDAb21c16eDC4C6134AC8D0",
    "constructorArgs": ["My Token", "MTK", "1000000000000000000000000"],
    "deploymentTx": "0x3a4e5f...",
    "deployer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "timestamp": "2023-10-25T14:32:08.321Z",
    "network": "sonicblaze",
    "chainId": 11155111
  }
}

These records enable reliable contract verification and system reconstruction.

Interoperability

Cross-Protocol Integration

Axicov simplifies integration with major DeFi protocols:

  • Uniswap - Liquidity provision and trading

  • Aave - Lending and borrowing

  • Chainlink - Oracle data feeds

  • OpenZeppelin - Security standards

  • Thirdweb - NFT infrastructure

Standardized Interfaces

Axicov encourages the use of standard interfaces:

// Example of IERC20 interface implementation
interface IERC20 {
    function transfer(address to, uint256 amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);
    // Other standard functions...
}

By adhering to established standards, contracts built with Axicov maintain compatibility across the ecosystem.

Last updated