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
- Copy the example environment file:
cp .env.example .env
- Edit
.envwith 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:
- Clean the cache:
yarn clean
- Reinstall dependencies:
yarn install
- Try compiling again:
yarn compile
Network Issues
If you encounter network-related errors:
- Check your internet connection
- Verify your Infura API key
- Ensure you're targeting the correct network
Test Failures
If tests are failing:
- Ensure all dependencies are installed
- Check that your environment is properly configured
- Run tests with verbose output:
yarn test --verbose
IDE Setup
VSCode Configuration
-
Install recommended extensions:
- Solidity
- Hardhat
- ESLint
- Prettier
-
Configure settings:
{
"solidity.compileUsingRemoteVersion": "0.8.27",
"solidity.defaultCompiler": "remote",
"editor.formatOnSave": true
}
Security Best Practices
- Never commit your
.envfile - Keep your private keys secure
- Use a dedicated development mnemonic
- Follow gas optimization guidelines
Next Steps
- Review the Quick Start Guide
- Explore Contract Documentation
- Check Test Cases
- Read Security Features