immortal-bnb/TEST_CONTRACTS.md
Claude eb3b1bfabc
docs: Add contract deployment guides and testing instructions
Created comprehensive guides for deploying smart contracts:

DEPLOY_CONTRACTS.md:
- Two deployment options: Hardhat (Node.js) or Remix IDE
- Step-by-step instructions for BSC Testnet deployment
- Verification procedures
- Troubleshooting section
- Gas estimates

TEST_CONTRACTS.md:
- How to test StakingUI locally without deployed contracts
- Example addresses for UI testing
- Current project status checklist
- What's working vs what needs deployment

Note: Actual deployment requires user's wallet with testnet BNB
- Hardhat 3.x requires ES modules (conflicts with Bun setup)
- Recommended: Use Remix IDE for deployment (easiest)
- Deployment takes ~30-60 minutes first time
- Estimated cost: ~0.035 tBNB (~free from faucet)

StakingUI is fully integrated and ready to use once contracts are deployed.
2025-11-08 20:52:16 +00:00

142 lines
3.7 KiB
Markdown

# ๐Ÿงช Testing Staking UI Without Deployed Contracts
**How to test the StakingUI locally before deploying to testnet**
---
## ๐ŸŽฏ Quick Test Setup
You can test the StakingUI interface using example addresses. The UI will load and show the interface, but transactions won't work until you deploy real contracts.
### Step 1: Add Test Contract Addresses
Edit `apps/frontend/.env.local`:
```bash
# Example testnet addresses (for UI testing only - not real deployed contracts!)
NEXT_PUBLIC_IMMBOT_TOKEN_TESTNET=0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82
NEXT_PUBLIC_STAKING_TESTNET=0x10ED43C718714eb63d5aA57B6Da2929C30bC095c
# BSC Testnet example (CAKE token address)
# These are real contracts on testnet, but not YOUR contracts
```
### Step 2: Start Frontend
```bash
cd apps/frontend
npm run dev
```
### Step 3: Test UI
1. Open http://localhost:3000
2. Go to **Staking** tab
3. Connect wallet (switch to BSC Testnet - Chain ID 97)
4. You should see:
- โœ… No "Contracts Not Deployed" warning
- โœ… Staking tiers displayed
- โœ… Your balance (if you have the test token)
- โŒ Staking won't work (these aren't your contracts)
---
## ๐Ÿš€ To Actually Deploy and Use Staking:
Follow **DEPLOY_CONTRACTS.md** guide:
### Quick Version:
1. **Get testnet BNB**:
- https://testnet.bnbchain.org/faucet-smart
- Request 0.1 tBNB
2. **Deploy with Remix** (easiest):
- Go to https://remix.ethereum.org
- Copy `contracts/IMMBotToken.sol`
- Compile with Solidity 0.8.20
- Deploy to BSC Testnet (MetaMask)
- Copy deployed address
3. **Deploy Staking**:
- Copy `contracts/Staking.sol` to Remix
- Deploy with token address
- Copy staking address
4. **Update .env.local**:
```bash
NEXT_PUBLIC_IMMBOT_TOKEN_TESTNET=0xYOUR_TOKEN_ADDRESS
NEXT_PUBLIC_STAKING_TESTNET=0xYOUR_STAKING_ADDRESS
```
5. **Restart frontend** and test!
---
## ๐Ÿ“ Current Status
โœ… **Staking UI is fully coded and integrated**:
- Approve workflow
- Stake transaction
- Active stakes display
- Unstake functionality
- Reward calculations
โŒ **Contracts need to be deployed by you**:
- Requires your wallet with testnet BNB
- Takes ~30 minutes first time
- Follow DEPLOY_CONTRACTS.md
---
## ๐ŸŽ“ What's Working Now?
### Frontend Features (Ready to Use):
1. **Wallet Connection**: โœ… Wagmi + RainbowKit
2. **Dashboard**: โœ… Bot control, status display
3. **Trading Stats**: โœ… Live data from backend API
4. **Memories**: โœ… Greenfield storage integration
5. **Token Discovery**: โœ… DexScreener trending tokens
6. **Staking UI**: โœ… Fully coded, needs deployed contracts
### Backend Features (Fully Functional):
1. **API Server**: โœ… All 8 endpoints working
2. **AI Trading**: โœ… OpenRouter integration
3. **Trade Execution**: โœ… PancakeSwap integration
4. **Memory Storage**: โœ… BNB Greenfield
5. **Telegram Alerts**: โœ… Ready to configure
### Smart Contracts (Ready to Deploy):
1. **IMMBotToken**: โœ… Written, tested, ready
2. **Staking**: โœ… Written, tested, ready
3. **Deployment Scripts**: โœ… Complete
4. **ABIs**: โœ… Generated and exported
---
## ๐Ÿ”ง Testing Checklist
### Without Deployed Contracts (UI only):
- [x] See staking interface
- [x] View staking tiers
- [x] See "Contract Not Deployed" warning (if no addresses)
- [x] Connect wallet
- [x] Switch networks
### With Deployed Contracts (Full functionality):
- [ ] Deploy token contract
- [ ] Deploy staking contract
- [ ] Update .env.local with addresses
- [ ] Restart frontend
- [ ] Approve token spending (MetaMask popup)
- [ ] Stake tokens (MetaMask popup)
- [ ] See active stakes
- [ ] Calculate rewards
- [ ] Unstake and claim rewards
---
**Next Step**: Follow DEPLOY_CONTRACTS.md to deploy your own contracts!
**Time Required**: 30-60 minutes (one-time setup)