Quick Start Guide
Get up and running with KagePool in minutes. This guide will walk you through the basic setup and first interactions with the contract system.
TLDR
# Clone and install
git clone https://github.com/your-org/kage-stake-cs.git
cd kage-stake-cs
yarn install
# Configure
cp .env.example .env
# Edit .env with your settings
# Deploy
yarn hardhat deploy --network <your-network>
Step-by-Step Guide
1. Installation
First, ensure you have the prerequisites installed:
- Node.js ≥ 20.0.0
- Yarn ≥ 1.22.15
Then clone and set up the project:
git clone https://github.com/your-org/kage-stake-cs.git
cd kage-stake-cs
yarn install
2. Configuration
Copy the example environment file:
cp .env.example .env
Edit .env with your settings:
# Required: Network Configuration
INFURA_API_KEY=your_infura_key
ETHERSCAN_API_KEY=your_etherscan_key
# Required: Deployment Account
PRIVATE_KEY=your_private_key
# Optional: Contract Configuration
TREASURY_ADDRESS=0x...
REWARD_DISTRIBUTOR_ADDRESS=0x...
3. Compile Contracts
yarn compile
4. Run Tests
yarn test
5. Deploy
Deploy to your chosen network:
yarn hardhat deploy --network <network-name>
First Steps with KagePool
Create a Staking Pool
const kagePool = await ethers.getContract("KagePool");
// Create a 30-day staking pool with 10% APY
await kagePool.kageAddPool(
ethers.utils.parseEther("1000000"), // 1M tokens cap
ethers.utils.parseEther("100"), // 100 tokens minimum
30 days, // 30 day lock
Math.floor(Date.now() / 1000), // Start now
Math.floor(Date.now() / 1000) + 90 days, // End in 90 days
1000 // 10% APY (basis points)
);
Stake Tokens
// First approve tokens
const token = await ethers.getContract("YourToken");
await token.approve(kagePool.address, amount);
// Then stake
await kagePool.kageDeposit(0, amount);
Check Rewards
const rewards = await kagePool.kageCalculateCurrentRewards(0, userAddress);
console.log(`Current rewards: ${ethers.utils.formatEther(rewards)}`);
Common Operations
Early Withdrawal
await kagePool.kageEarlyWithdrawAll(0);
Regular Withdrawal
await kagePool.kageWithdraw(0, amount);
Allocate Revenue
await kagePool.kageAllocateRevenue(
[0, 1], // Pool IDs
[amount1, amount2], // Amounts
true, // Accumulative
);
Next Steps
- Read the Contract Documentation for detailed API reference
- Check Security Features for best practices
- Review Test Cases for implementation examples
- Follow the Integration Guide for advanced usage
Troubleshooting
Compilation Errors
If you encounter compilation errors:
- Clean the cache:
yarn clean - Reinstall dependencies:
yarn install - Try compiling again:
yarn compile
Deployment Failures
Common deployment issues:
- Insufficient funds
- Incorrect network configuration
- Invalid private key
Support
Need help? Check out our: