Skip to main content

Installation Guide

This guide will walk you through setting up the KagePool smart contract system on your local development environment.

Prerequisites

  • Node.js ≥ 20.0.0
  • Yarn ≥ 1.22.15
  • Git
  • Hardhat-compatible IDE (VSCode recommended)

Quick Start Flowchart

Step-by-Step Installation

1. Clone the Repository

git clone https://github.com/your-org/kage-stake-cs.git
cd kage-stake-cs

2. Install Dependencies

yarn install

3. Configure Environment

  1. Copy the example environment file:
cp .env.example .env
  1. Edit .env with your settings:
# Required
INFURA_API_KEY=your_infura_key
ETHERSCAN_API_KEY=your_etherscan_key
PRIVATE_KEY=your_private_key

# Optional
TREASURY_ADDRESS=0x...
REWARD_DISTRIBUTOR_ADDRESS=0x...

4. Compile Contracts

yarn compile

5. Run Tests

# Run all tests
yarn test

# Run specific test file
yarn test test/KagePool.test.ts

# Run with gas reporting
REPORT_GAS=true yarn test

6. Generate Documentation

# Start documentation server
yarn docs:start

# Build documentation
yarn docs:build

Troubleshooting

Compilation Errors

If you encounter compilation errors:

  1. Clean the cache:
yarn clean
  1. Reinstall dependencies:
yarn install
  1. Try compiling again:
yarn compile

Network Issues

If you encounter network-related errors:

  1. Check your internet connection
  2. Verify your Infura API key
  3. Ensure you're targeting the correct network

Test Failures

If tests are failing:

  1. Ensure all dependencies are installed
  2. Check that your environment is properly configured
  3. Run tests with verbose output:
yarn test --verbose

IDE Setup

VSCode Configuration

  1. Install recommended extensions:

    • Solidity
    • Hardhat
    • ESLint
    • Prettier
  2. Configure settings:

{
"solidity.compileUsingRemoteVersion": "0.8.27",
"solidity.defaultCompiler": "remote",
"editor.formatOnSave": true
}

Security Best Practices

  1. Never commit your .env file
  2. Keep your private keys secure
  3. Use a dedicated development mnemonic
  4. Follow gas optimization guidelines

Next Steps