How It Works
LazaiTrader combines several components to provide secure, automated trading. Here's the complete flow from registration to trade execution.
System Overview
┌─────────────────────────────────────────────────────────────────┐
│ USER (Telegram) │
│ │
│ /start /deposit /balance /config /withdraw /chart │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ LazaiTrader Bot │
│ (Cloudflare Workers) │
│ │
│ • Handles user commands │
│ • Monitors prices every minute │
│ • Checks trigger conditions │
│ • Executes trades when conditions met │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Smart Contract Wallet (SCW) │
│ (On Blockchain) │
│ │
│ • Holds your tokens │
│ • Executes trades on whitelisted DEXs │
│ • Withdrawals ONLY to your personal wallet │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Whitelisted DEXs │
│ │
│ • HerculesDEX (Metis) │
│ • LazaiSwap (Testnet) │
└─────────────────────────────────────────────────────────────────┘
User Journey
1. Registration
When you send /start to the bot:
- Bot asks for your Ethereum wallet address (EOA)
- You provide your MetaMask/Trust Wallet address
- Bot registers you in the system
- Your EOA becomes the only address that can receive withdrawals
Your EOA (Externally Owned Account) is your personal wallet address - the one you control with a private key or seed phrase.
2. Wallet Deployment
When you send /deposit:
- Bot deploys a Smart Contract Wallet (SCW) for you
- SCW is deployed on all active chains automatically
- You receive the same SCW address on every chain
- Bot shows you where to send funds
3. Funding Your Wallet
- Copy your SCW deposit address
- Send supported tokens (ETH, USDC, etc.) from any wallet
- Bot detects deposits automatically
- Use
/balanceto verify your funds arrived
4. Strategy Configuration
When you send /config:
- Select a trading pair (e.g., ETH-USDC)
- Set your trigger percentage (e.g., 10% price movement)
- Set your trade percentage (e.g., 25% of balance per trade)
- Set min/max trade amounts
- Set multiplier for consecutive trades
5. Automated Trading
Once configured, the system works automatically:
Every 1 Minute:
┌─────────────────────────────────────────────────────────────┐
│ 1. Fetch current prices from multiple sources │
│ 2. Compare to your last trade price │
│ 3. Check if trigger conditions are met │
│ │
│ If price moved by your trigger percentage: │
│ ├─ Price UP → Execute SELL │
│ └─ Price DOWN → Execute BUY │
│ │
│ 4. Calculate trade amount based on your settings │
│ 5. Execute trade on whitelisted DEX │
│ 6. Record trade and notify you via Telegram │
└─────────────────────────────────────────────────────────────┘
6. Withdrawals
When you send /withdraw:
- Select the chain to withdraw from
- Select the token to withdraw
- Bot executes withdrawal from your SCW
- Funds are sent directly to your EOA (your personal wallet)
Withdrawals can ONLY go to the wallet address you registered with. This is a security feature - even if someone gains access to the bot, they cannot redirect your funds.
Trading Logic Explained
Trigger Conditions
The bot uses percentage-based triggers to decide when to trade:
| Scenario | Condition | Action |
|---|---|---|
| Price rises | Current price > Last trade price + Trigger% | SELL |
| Price drops | Current price < Last trade price - Trigger% | BUY |
Example:
- Last trade at $3,000
- Trigger percentage: 10%
- Current price: $3,400 (13.3% increase)
- Result: SELL triggered (13.3% > 10%)
Trade Amount Calculation
Trade Amount = Balance × Trade Percentage × (Multiplier ^ Consecutive Count)
Example:
- Balance: 1 ETH
- Trade Percentage: 25%
- Multiplier: 1.5
- Consecutive sells: 2
Amount = 1 ETH × 0.25 × (1.5²) = 0.5625 ETH
This increases position size on consecutive moves in the same direction.
What Happens to Your Funds
| State | Where Are Funds? | Who Controls? |
|---|---|---|
| Before deposit | Your personal wallet | You |
| After deposit | Your Smart Contract Wallet | You (via bot or direct) |
| During trade | Moving through DEX | Smart contract logic |
| After trade | Back in your SCW | You |
| After withdrawal | Your personal wallet | You |
Key Point: Your funds are always in wallets you control. LazaiTrader never has custody of your assets.
Next Steps
Ready to start? Head to Getting Started for step-by-step instructions.