pragma-openclaw 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/kairos/AGENTS.md +14 -0
- package/agents/pragma/AGENTS.md +14 -0
- package/package.json +1 -1
- package/skills/pragma-core/SKILL.md +248 -27
package/agents/kairos/AGENTS.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
6. **Pass agentId to all trading tools** — When operating as a sub-agent (spawned via sessions_spawn with a pragma sub-agent ID), include `agentId` in every `pragma_` trading tool call. This routes through the sub-agent's delegation chain with budget tracking.
|
|
13
13
|
7. **Use journal tools** — Call `pragma_report_agent_status` on start/finish/pause. Call `pragma_write_agent_memo` to persist reasoning (baselines, watchlists, trade plans) that survives context compaction.
|
|
14
14
|
8. **NEVER delegate** — Call ALL tools directly. Never spawn sub-agents or sub-tasks. You ARE the analyst and executor. Delegating loses your accumulated context.
|
|
15
|
+
9. **On retry, re-pass ALL parameters** — If a tool call fails and you retry, include EVERY parameter from the original call. Never drop optional parameters like `collateralToken` on retry — omitting it changes the tool's behavior (e.g., defaulting to MON collateral instead of LVUSD).
|
|
15
16
|
|
|
16
17
|
---
|
|
17
18
|
|
|
@@ -33,6 +34,19 @@
|
|
|
33
34
|
| `pragma.leverup_open_limit_order` | Place limit order |
|
|
34
35
|
| `pragma.leverup_cancel_limit_order` | Cancel limit order |
|
|
35
36
|
|
|
37
|
+
### Collateral Tokens
|
|
38
|
+
|
|
39
|
+
All `pragma.leverup_open_trade` and `pragma.leverup_open_limit_order` calls require `collateralToken`:
|
|
40
|
+
|
|
41
|
+
| Token | Decimals | Notes |
|
|
42
|
+
|-------|----------|-------|
|
|
43
|
+
| **MON** | 18 | Native — full amount sent as msg.value. Default if omitted. |
|
|
44
|
+
| **USDC** | 6 | Stablecoin |
|
|
45
|
+
| **LVUSD** | 18 | LeverUp vault USD |
|
|
46
|
+
| **LVMON** | 18 | LeverUp vault MON |
|
|
47
|
+
|
|
48
|
+
**ALWAYS specify `collateralToken` explicitly.** Never omit it — the default (MON) sends the full collateral as native value, which may exceed delegation limits. On retry, re-pass the same `collateralToken` value.
|
|
49
|
+
|
|
36
50
|
### Market Intelligence (8)
|
|
37
51
|
| Tool | Purpose | x402 Cost |
|
|
38
52
|
|------|---------|-----------|
|
package/agents/pragma/AGENTS.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
7. **Pass agentId to all trading tools** — When operating as a sub-agent (spawned via sessions_spawn with a pragma sub-agent ID), include `agentId` in every `pragma_` trading tool call. This routes through the sub-agent's delegation chain with budget tracking.
|
|
14
14
|
8. **Use journal tools** — Call `pragma_report_agent_status` on start/finish/pause. Call `pragma_write_agent_memo` to persist reasoning that survives context compaction.
|
|
15
15
|
9. **NEVER delegate** — Call ALL tools directly. Never spawn sub-agents or sub-tasks. You ARE the executor. Delegating loses your accumulated context.
|
|
16
|
+
10. **On retry, re-pass ALL parameters** — If a tool call fails and you retry, include EVERY parameter from the original call. Never drop optional parameters like `collateralToken` on retry — omitting it changes the tool's behavior (e.g., defaulting to MON collateral instead of LVUSD).
|
|
16
17
|
|
|
17
18
|
---
|
|
18
19
|
|
|
@@ -34,6 +35,19 @@
|
|
|
34
35
|
| `pragma.leverup_open_limit_order` | Place limit order |
|
|
35
36
|
| `pragma.leverup_cancel_limit_order` | Cancel limit order |
|
|
36
37
|
|
|
38
|
+
### Collateral Tokens
|
|
39
|
+
|
|
40
|
+
All `pragma.leverup_open_trade` and `pragma.leverup_open_limit_order` calls require `collateralToken`:
|
|
41
|
+
|
|
42
|
+
| Token | Decimals | Notes |
|
|
43
|
+
|-------|----------|-------|
|
|
44
|
+
| **MON** | 18 | Native — full amount sent as msg.value. Default if omitted. |
|
|
45
|
+
| **USDC** | 6 | Stablecoin |
|
|
46
|
+
| **LVUSD** | 18 | LeverUp vault USD |
|
|
47
|
+
| **LVMON** | 18 | LeverUp vault MON |
|
|
48
|
+
|
|
49
|
+
**ALWAYS specify `collateralToken` explicitly.** Never omit it — the default (MON) sends the full collateral as native value, which may exceed delegation limits. On retry, re-pass the same `collateralToken` value.
|
|
50
|
+
|
|
37
51
|
### nad.fun (8)
|
|
38
52
|
| Tool | Purpose |
|
|
39
53
|
|------|---------|
|
package/package.json
CHANGED
|
@@ -85,6 +85,8 @@ metadata:
|
|
|
85
85
|
|
|
86
86
|
6. **Use the correct delegation tool.** When you need a new delegation, use `pragma_request_delegation` (the web-based approval flow). NEVER use `pragma_create_root_delegation` — that tool requires macOS Touch ID and will always fail on this platform.
|
|
87
87
|
|
|
88
|
+
7. **On retry, re-pass ALL parameters.** If a tool call fails and you retry, include EVERY parameter from the original call. Never drop optional parameters like `collateralToken` on retry — omitting it changes the tool's behavior (e.g., defaulting to MON collateral instead of LVUSD).
|
|
89
|
+
|
|
88
90
|
---
|
|
89
91
|
|
|
90
92
|
## Prerequisites
|
|
@@ -110,8 +112,45 @@ You do NOT need to check delegation before every operation — just try the oper
|
|
|
110
112
|
| "No delegation found" | Tell user → use pragma-delegation skill to create one |
|
|
111
113
|
| "LimitedCalls exceeded" | Delegation used up all allowed calls → renew |
|
|
112
114
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Session Key Gas Management
|
|
118
|
+
|
|
119
|
+
**MANDATORY: Check session key balance before ANY write operation.**
|
|
120
|
+
|
|
121
|
+
### Pre-Transaction Check
|
|
122
|
+
|
|
123
|
+
Before every swap, transfer, wrap, unwrap, buy, sell, or open/close trade:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
1. pragma_check_session_key_balance (with operationType or estimatedOperations)
|
|
127
|
+
2. If needsFunding: pragma_fund_session_key → WAIT for result
|
|
128
|
+
3. THEN execute the operation
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Gas Cost Reference
|
|
132
|
+
|
|
133
|
+
| Operation | Gas Cost (MON) |
|
|
134
|
+
|-----------|---------------|
|
|
135
|
+
| swap | 0.14 |
|
|
136
|
+
| transfer | 0.04 |
|
|
137
|
+
| wrap / unwrap | 0.04 |
|
|
138
|
+
| leverup open / close | 0.14 |
|
|
139
|
+
| nadfun buy / sell | 0.14 |
|
|
140
|
+
|
|
141
|
+
**Formula:** `total_gas = sum(operation_costs) + 0.02 MON buffer`
|
|
142
|
+
|
|
143
|
+
**Example:** Swap + transfer = 0.14 + 0.04 + 0.02 buffer = **0.20 MON needed**
|
|
144
|
+
|
|
145
|
+
### Funding Rule
|
|
146
|
+
|
|
147
|
+
**NEVER call `pragma_fund_session_key` and execution tools simultaneously.**
|
|
148
|
+
|
|
149
|
+
The session key needs funds BEFORE it can pay gas. Always fund first, wait for completion, then execute.
|
|
150
|
+
|
|
151
|
+
### Gas Thresholds
|
|
152
|
+
|
|
153
|
+
- **Low gas (> 0.02 MON remaining):** Use `pragma_fund_session_key` — transfers MON from Smart Account via delegation. No extra approval needed.
|
|
115
154
|
- **Zero gas (< 0.02 MON):** Self-funding CANNOT work because the session key needs gas to submit the funding transaction. Tell the user: "Your session key is out of gas. Please send at least 0.5 MON to: [session key address]"
|
|
116
155
|
- **No UserOp on this platform.** The bundler/UserOp path is not available here. Do NOT mention UserOp to the user.
|
|
117
156
|
|
|
@@ -173,7 +212,7 @@ You do NOT need to check delegation before every operation — just try the oper
|
|
|
173
212
|
| `pragma_leverup_get_quote` | Position quote (margin, fees, liq price) |
|
|
174
213
|
| `pragma_leverup_open_trade` | Open market position |
|
|
175
214
|
| `pragma_leverup_close_trade` | Close position |
|
|
176
|
-
| `pragma_leverup_update_margin` | Add
|
|
215
|
+
| `pragma_leverup_update_margin` | Add margin (normal leverage only) |
|
|
177
216
|
| `pragma_leverup_update_tpsl` | Update TP/SL levels |
|
|
178
217
|
| `pragma_leverup_get_market_stats` | OI, volume, spread per pair |
|
|
179
218
|
| `pragma_leverup_get_funding_rates` | Holding fee rates (carry cost) |
|
|
@@ -224,43 +263,164 @@ You do NOT need to check delegation before every operation — just try the oper
|
|
|
224
263
|
|
|
225
264
|
---
|
|
226
265
|
|
|
266
|
+
## LeverUp Platform Constraints
|
|
267
|
+
|
|
268
|
+
**CRITICAL: Always perform a risk simulation (`pragma_leverup_get_quote`) before opening any position.**
|
|
269
|
+
|
|
270
|
+
### Two Trading Modes
|
|
271
|
+
|
|
272
|
+
| Feature | Normal Mode (1-100x) | Zero-Fee Mode (500x/750x/1001x) |
|
|
273
|
+
|---------|----------------------|----------------------------------|
|
|
274
|
+
| **Pairs** | All standard pairs (BTC, ETH, MON, etc.) | 500BTC/USD, 500ETH/USD only |
|
|
275
|
+
| **Open/Close Fees** | 0.045% | 0% if PnL < 0, profit sharing if profitable |
|
|
276
|
+
| **Order Types** | Market + Limit | **Market only** |
|
|
277
|
+
| **Add/Remove Margin** | Yes | **Not allowed** |
|
|
278
|
+
| **Leverage Values** | Any from 1-100 | **Exactly 500, 750, or 1001** |
|
|
279
|
+
|
|
280
|
+
**CRITICAL:** If user requests 500BTC or 500ETH, they MUST use exactly 500x, 750x, or 1001x leverage. Any other value will fail with "Below degen mode min leverage" error.
|
|
281
|
+
|
|
282
|
+
### Order Types: Market vs Limit
|
|
283
|
+
|
|
284
|
+
| Order Type | When to Use | Trigger Behavior |
|
|
285
|
+
|------------|-------------|------------------|
|
|
286
|
+
| **Market** (`pragma_leverup_open_trade`) | Execute immediately at current price | Fills instantly |
|
|
287
|
+
| **Limit** (`pragma_leverup_open_limit_order`) | Wait for better entry price | Triggers when market reaches price |
|
|
288
|
+
|
|
289
|
+
**Limit Order Trigger Rules:**
|
|
290
|
+
- **Long limit orders:** Trigger price must be BELOW current market (buy the dip)
|
|
291
|
+
- **Short limit orders:** Trigger price must be ABOVE current market (sell the top)
|
|
292
|
+
|
|
293
|
+
**Limit orders are NOT available for Zero-Fee pairs (500BTC/500ETH).**
|
|
294
|
+
|
|
295
|
+
### Minimum Trade Thresholds
|
|
296
|
+
|
|
297
|
+
LeverUp enforces the following limits. Always inform the user if their trade is near or below these thresholds.
|
|
298
|
+
|
|
299
|
+
- **HARD LIMIT — Minimum Position Size**: $200.00 USD (Margin x Leverage) — **Contract will reject trades below this**
|
|
300
|
+
- **Soft Guideline — Minimum Margin**: $10.00 USD (recommended but not strictly enforced)
|
|
301
|
+
|
|
302
|
+
### Collateral Options
|
|
303
|
+
|
|
304
|
+
**CRITICAL: Always pass the `collateralToken` parameter explicitly when opening LeverUp trades. Never omit it — the default (MON) may not be what the user intends.**
|
|
305
|
+
|
|
306
|
+
| Token | Decimals | When to Use |
|
|
307
|
+
|-------|----------|-------------|
|
|
308
|
+
| **MON** (native) | 18 | Default — full amount sent as native value |
|
|
309
|
+
| **USDC** | 6 | Stablecoin strategies |
|
|
310
|
+
| **LVUSD** | 18 | LeverUp vault USD token |
|
|
311
|
+
| **LVMON** | 18 | LeverUp vault MON token |
|
|
312
|
+
|
|
313
|
+
**On retry after failure:** You MUST re-pass `collateralToken` with the same value. Dropping it changes behavior (defaults to MON, which sends full amount as native value and may hit delegation limits).
|
|
314
|
+
|
|
315
|
+
### Stop Loss (SL) and Take Profit (TP)
|
|
316
|
+
|
|
317
|
+
SL and TP can be set when opening a position. Both are optional (set to 0 to disable).
|
|
318
|
+
|
|
319
|
+
**TP Limits (Contract-Enforced):**
|
|
320
|
+
|
|
321
|
+
| Leverage | Max Take Profit |
|
|
322
|
+
|----------|-----------------|
|
|
323
|
+
| < 50x | 500% profit |
|
|
324
|
+
| >= 50x | 300% profit |
|
|
325
|
+
|
|
326
|
+
**SL/TP Rules:**
|
|
327
|
+
|
|
328
|
+
- Stop Loss: Must be BELOW entry price (Long) or ABOVE entry price (Short)
|
|
329
|
+
- Take Profit: Must be ABOVE entry price (Long) or BELOW entry price (Short)
|
|
330
|
+
- **Cannot be cancelled** once set, but can be edited via `pragma_leverup_update_tpsl`
|
|
331
|
+
- Prices are in USD (e.g., "85000" for $85,000)
|
|
332
|
+
|
|
333
|
+
**Example — Long BTC at $90,000:**
|
|
334
|
+
- Valid SL: $85,000 (below entry)
|
|
335
|
+
- Valid TP: $100,000 (above entry, within 500%/300% limit)
|
|
336
|
+
|
|
337
|
+
**Example — Short BTC at $90,000:**
|
|
338
|
+
- Valid SL: $95,000 (above entry)
|
|
339
|
+
- Valid TP: $80,000 (below entry)
|
|
340
|
+
|
|
341
|
+
### Managing Positions
|
|
342
|
+
|
|
343
|
+
1. `pragma_leverup_list_positions` — Check Health Factor of active trades.
|
|
344
|
+
2. If Health < 20%: Suggest `pragma_leverup_update_margin` to add collateral.
|
|
345
|
+
- **NOTE:** This does NOT work for 500x/750x/1001x positions!
|
|
346
|
+
3. To update TP/SL: Use `pragma_leverup_update_tpsl`.
|
|
347
|
+
4. To lock in profit: Use `pragma_leverup_close_trade`.
|
|
348
|
+
|
|
349
|
+
### Update Margin Limitations
|
|
350
|
+
|
|
351
|
+
`pragma_leverup_update_margin` only works for normal leverage (1-100x) positions.
|
|
352
|
+
|
|
353
|
+
- **Only ADDING margin is supported** — the contract does not allow margin withdrawal.
|
|
354
|
+
- **Zero-Fee positions (500x/750x/1001x) CANNOT add margin.**
|
|
355
|
+
- The tool will show a warning, and the contract will reject the transaction if attempted.
|
|
356
|
+
|
|
357
|
+
### Update TP/SL
|
|
358
|
+
|
|
359
|
+
Use `pragma_leverup_update_tpsl` to modify take profit and stop loss on existing positions:
|
|
360
|
+
|
|
361
|
+
- Pass price in USD (e.g., '110000' for $110,000)
|
|
362
|
+
- Set to '0' to disable TP or SL
|
|
363
|
+
- At least one of `takeProfit` or `stopLoss` must be provided
|
|
364
|
+
- Works for all position types including Zero-Fee positions
|
|
365
|
+
|
|
366
|
+
### Managing Limit Orders
|
|
367
|
+
|
|
368
|
+
1. `pragma_leverup_list_limit_orders` — View all pending orders (not yet filled)
|
|
369
|
+
2. `pragma_leverup_cancel_limit_order` — Cancel one or more pending orders
|
|
370
|
+
- Accepts single orderHash or array for batch cancel
|
|
371
|
+
- Use batch cancel when user wants to "cancel all orders"
|
|
372
|
+
|
|
373
|
+
**Distinction:**
|
|
374
|
+
- `pragma_leverup_list_positions` → FILLED positions (active trades)
|
|
375
|
+
- `pragma_leverup_list_limit_orders` → PENDING orders (waiting to trigger)
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
227
379
|
## Operation Flows
|
|
228
380
|
|
|
229
381
|
### Swap (Single)
|
|
230
382
|
|
|
231
383
|
```
|
|
232
384
|
1. pragma_get_all_balances → Verify source token balance
|
|
233
|
-
2.
|
|
234
|
-
3.
|
|
235
|
-
4.
|
|
385
|
+
2. pragma_check_session_key_balance → Verify gas (operationType: "swap")
|
|
386
|
+
3. If needsFunding: pragma_fund_session_key → WAIT
|
|
387
|
+
4. pragma_get_swap_quote(from, to, amount) → Show quote to user
|
|
388
|
+
5. pragma_execute_swap(from, to, amount) → Execute after confirmation
|
|
389
|
+
6. pragma_get_all_balances → Confirm new balances
|
|
236
390
|
```
|
|
237
391
|
|
|
238
392
|
### Swap (Batch)
|
|
239
393
|
|
|
240
|
-
For multiple swaps
|
|
394
|
+
For multiple independent swaps:
|
|
241
395
|
|
|
242
396
|
```
|
|
243
397
|
1. pragma_get_all_balances → Portfolio snapshot
|
|
244
|
-
2.
|
|
398
|
+
2. pragma_check_session_key_balance → estimatedOperations: N
|
|
399
|
+
3. If needsFunding: pragma_fund_session_key → WAIT
|
|
400
|
+
4. For each swap:
|
|
245
401
|
a. pragma_get_swap_quote(...) → Get quote
|
|
246
402
|
b. pragma_execute_swap(...) → Execute
|
|
247
|
-
|
|
403
|
+
5. pragma_get_all_balances → Final portfolio
|
|
248
404
|
```
|
|
249
405
|
|
|
250
406
|
### Transfer
|
|
251
407
|
|
|
252
408
|
```
|
|
253
409
|
1. pragma_get_balance(token) → Verify sufficient balance
|
|
254
|
-
2.
|
|
255
|
-
3.
|
|
410
|
+
2. pragma_check_session_key_balance → operationType: "transfer"
|
|
411
|
+
3. If needsFunding: pragma_fund_session_key → WAIT
|
|
412
|
+
4. pragma_transfer(token, to, amount) → Execute transfer
|
|
413
|
+
5. pragma_get_balance(token) → Confirm new balance
|
|
256
414
|
```
|
|
257
415
|
|
|
258
416
|
### Wrap / Unwrap
|
|
259
417
|
|
|
260
418
|
```
|
|
261
419
|
1. pragma_get_all_balances → Check MON/WMON balance
|
|
262
|
-
2.
|
|
263
|
-
3.
|
|
420
|
+
2. pragma_check_session_key_balance → operationType: "wrap" or "unwrap"
|
|
421
|
+
3. If needsFunding: pragma_fund_session_key → WAIT
|
|
422
|
+
4. pragma_wrap(amount) or pragma_unwrap(amount)
|
|
423
|
+
5. pragma_get_all_balances → Confirm
|
|
264
424
|
```
|
|
265
425
|
|
|
266
426
|
### nad.fun Buy
|
|
@@ -270,8 +430,10 @@ For multiple swaps in sequence:
|
|
|
270
430
|
2. pragma_nadfun_token_info(address) → Token details
|
|
271
431
|
3. pragma_nadfun_status(address) → Bonding curve progress
|
|
272
432
|
4. pragma_nadfun_quote(address, "buy", amount) → Price quote
|
|
273
|
-
5.
|
|
274
|
-
6.
|
|
433
|
+
5. pragma_check_session_key_balance → operationType: "swap"
|
|
434
|
+
6. If needsFunding: pragma_fund_session_key → WAIT
|
|
435
|
+
7. pragma_nadfun_buy(address, amount) → Execute buy
|
|
436
|
+
8. pragma_nadfun_positions → Confirm position
|
|
275
437
|
```
|
|
276
438
|
|
|
277
439
|
### nad.fun Sell
|
|
@@ -279,37 +441,52 @@ For multiple swaps in sequence:
|
|
|
279
441
|
```
|
|
280
442
|
1. pragma_nadfun_positions → Current holdings
|
|
281
443
|
2. pragma_nadfun_quote(address, "sell", amount) → Price quote
|
|
282
|
-
3.
|
|
283
|
-
4.
|
|
444
|
+
3. pragma_check_session_key_balance → operationType: "swap"
|
|
445
|
+
4. If needsFunding: pragma_fund_session_key → WAIT
|
|
446
|
+
5. pragma_nadfun_sell(address, amount) → Execute sell
|
|
447
|
+
6. pragma_nadfun_positions → Confirm
|
|
284
448
|
```
|
|
285
449
|
|
|
286
450
|
### LeverUp Open Position
|
|
287
451
|
|
|
288
452
|
```
|
|
289
|
-
1. pragma_get_all_balances → Verify
|
|
453
|
+
1. pragma_get_all_balances → Verify collateral balance
|
|
290
454
|
2. pragma_leverup_list_pairs → Current prices and spreads
|
|
291
|
-
3. pragma_leverup_get_quote(pair, direction, leverage,
|
|
292
|
-
4.
|
|
293
|
-
5.
|
|
455
|
+
3. pragma_leverup_get_quote(pair, direction, leverage, margin) → MANDATORY quote
|
|
456
|
+
4. Review: Check minimum thresholds, Zero-Fee restrictions, warnings
|
|
457
|
+
5. Confirm with user: Show margin, position size, liq price, collateral token
|
|
458
|
+
6. pragma_check_session_key_balance → operationType: "swap"
|
|
459
|
+
7. If needsFunding: pragma_fund_session_key → WAIT
|
|
460
|
+
8. pragma_leverup_open_trade(pair, direction, leverage, margin, collateralToken, tp, sl)
|
|
461
|
+
↑ ALWAYS pass collateralToken explicitly
|
|
462
|
+
9. pragma_leverup_list_positions → Confirm position opened
|
|
294
463
|
```
|
|
295
464
|
|
|
296
465
|
### LeverUp Close Position
|
|
297
466
|
|
|
298
467
|
```
|
|
299
468
|
1. pragma_leverup_list_positions → Find position to close
|
|
300
|
-
2.
|
|
301
|
-
3.
|
|
469
|
+
2. pragma_check_session_key_balance → operationType: "swap"
|
|
470
|
+
3. If needsFunding: pragma_fund_session_key → WAIT
|
|
471
|
+
4. pragma_leverup_close_trade(positionId) → Close
|
|
472
|
+
5. pragma_get_all_balances → Confirm PnL settled
|
|
302
473
|
```
|
|
303
474
|
|
|
304
475
|
### Limit Order
|
|
305
476
|
|
|
306
477
|
```
|
|
307
|
-
1.
|
|
308
|
-
2. pragma_leverup_get_quote(pair, direction, leverage,
|
|
309
|
-
3.
|
|
310
|
-
4.
|
|
478
|
+
1. pragma_leverup_get_market_stats → Current prices
|
|
479
|
+
2. pragma_leverup_get_quote(pair, direction, leverage, margin) → Quote at target
|
|
480
|
+
3. Confirm trigger price with user (Long: below market, Short: above market)
|
|
481
|
+
4. pragma_check_session_key_balance → operationType: "swap"
|
|
482
|
+
5. If needsFunding: pragma_fund_session_key → WAIT
|
|
483
|
+
6. pragma_leverup_open_limit_order(pair, direction, leverage, margin, triggerPrice, collateralToken, tp, sl)
|
|
484
|
+
↑ ALWAYS pass collateralToken explicitly
|
|
485
|
+
7. pragma_leverup_list_limit_orders → Confirm order placed
|
|
311
486
|
```
|
|
312
487
|
|
|
488
|
+
**Note:** SL/TP for limit orders are validated against the TRIGGER price, not current market.
|
|
489
|
+
|
|
313
490
|
---
|
|
314
491
|
|
|
315
492
|
## Token Resolution
|
|
@@ -323,6 +500,16 @@ The MCP server handles resolution automatically. Use `pragma_list_verified_token
|
|
|
323
500
|
|
|
324
501
|
---
|
|
325
502
|
|
|
503
|
+
## Relative Amounts
|
|
504
|
+
|
|
505
|
+
When user says "all", "half", "max", or a percentage:
|
|
506
|
+
|
|
507
|
+
1. `pragma_get_balance` FIRST to get actual amount
|
|
508
|
+
2. Calculate the relative value
|
|
509
|
+
3. Proceed with the appropriate operation flow
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
326
513
|
## Error Handling
|
|
327
514
|
|
|
328
515
|
| Error | Action |
|
|
@@ -331,6 +518,10 @@ The MCP server handles resolution automatically. Use `pragma_list_verified_token
|
|
|
331
518
|
| "Insufficient balance" | Show current balance, suggest amount adjustment |
|
|
332
519
|
| "Slippage exceeded" | Retry with higher slippage or smaller amount |
|
|
333
520
|
| "Delegation expired" | Tell user to approve a new delegation |
|
|
521
|
+
| "LimitedCalls exceeded" | Delegation used up all allowed calls → renew |
|
|
522
|
+
| "ValueLteEnforcer:value-too-high" | Collateral token likely wrong — check `collateralToken` param |
|
|
523
|
+
| "Position is too small" | Margin x Leverage < $200 — increase margin or leverage |
|
|
524
|
+
| "Below degen mode min leverage" | Zero-Fee pairs need exactly 500x, 750x, or 1001x |
|
|
334
525
|
| "Rate limited" | Wait and retry |
|
|
335
526
|
| "Network error" | Retry once, then report |
|
|
336
527
|
|
|
@@ -350,9 +541,39 @@ The MCP server handles resolution automatically. Use `pragma_list_verified_token
|
|
|
350
541
|
- Expected outcome
|
|
351
542
|
- Any fees or slippage
|
|
352
543
|
|
|
544
|
+
**Unverified token warning:**
|
|
545
|
+
- If token is NOT in `pragma_list_verified_tokens`, show FULL contract address
|
|
546
|
+
- Include warning: "This token is unverified. Verify this is the correct contract address."
|
|
547
|
+
- This prevents users from swapping to copycat/scam tokens with the same symbol
|
|
548
|
+
|
|
353
549
|
**Execute without extra confirmation:**
|
|
354
550
|
- Balance checks
|
|
355
551
|
- Quote requests
|
|
356
552
|
- Market data queries
|
|
357
553
|
- Token info lookups
|
|
358
554
|
- Read-only operations
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## Response Format
|
|
559
|
+
|
|
560
|
+
**Balances:**
|
|
561
|
+
```
|
|
562
|
+
Token: Amount ($Value)
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**Quotes:**
|
|
566
|
+
```
|
|
567
|
+
Swap: 1 TOKEN_A → 0.999 TOKEN_B
|
|
568
|
+
Impact: 0.1%
|
|
569
|
+
Route: Direct
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
**Results:**
|
|
573
|
+
```
|
|
574
|
+
Success!
|
|
575
|
+
Tx: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
|
|
576
|
+
Received: 0.999 TOKEN_B
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**IMPORTANT:** Always show FULL transaction hashes (all 66 characters). Never truncate tx hashes — users need to copy them.
|