skillpp 0.1.0

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.
Files changed (208) hide show
  1. package/COMPATIBILITY.md +58 -0
  2. package/LICENSE +21 -0
  3. package/README.md +307 -0
  4. package/README.zh-CN.md +307 -0
  5. package/SKILL.md +490 -0
  6. package/adapters/binance-ai.md +22 -0
  7. package/adapters/claude.md +21 -0
  8. package/adapters/gemini.md +26 -0
  9. package/adapters/gpt.md +28 -0
  10. package/adapters/kimi.md +26 -0
  11. package/adapters/mimo.md +22 -0
  12. package/adapters/openclaw.md +29 -0
  13. package/assets/skillpp-banner.png +0 -0
  14. package/package.json +59 -0
  15. package/pipelines.md +310 -0
  16. package/prompts/newbie-mode.md +48 -0
  17. package/prompts/router-prompt.md +32 -0
  18. package/prompts/universal-system-prompt.md +41 -0
  19. package/registry.md +209 -0
  20. package/rules.md +323 -0
  21. package/schemas/audit.schema.json +67 -0
  22. package/schemas/checkpoint.schema.json +86 -0
  23. package/schemas/handoff.schema.json +82 -0
  24. package/schemas/token.schema.json +36 -0
  25. package/scripts/compatibility-check.mjs +130 -0
  26. package/scripts/selftest.mjs +384 -0
  27. package/scripts/skillpp.mjs +448 -0
  28. package/scripts/validate-skillpp.mjs +140 -0
  29. package/skillpp.manifest.json +714 -0
  30. package/skills/audit-plus/SKILL.md +612 -0
  31. package/skills/binance/binance/CHANGELOG.md +112 -0
  32. package/skills/binance/binance/LICENSE.md +9 -0
  33. package/skills/binance/binance/SKILL.md +69 -0
  34. package/skills/binance/binance/references/algo.md +21 -0
  35. package/skills/binance/binance/references/alpha.md +9 -0
  36. package/skills/binance/binance/references/auth.md +32 -0
  37. package/skills/binance/binance/references/c2c.md +5 -0
  38. package/skills/binance/binance/references/convert.md +19 -0
  39. package/skills/binance/binance/references/copy-trading.md +6 -0
  40. package/skills/binance/binance/references/crypto-loan.md +27 -0
  41. package/skills/binance/binance/references/derivatives-options-streams.md +25 -0
  42. package/skills/binance/binance/references/derivatives-options.md +85 -0
  43. package/skills/binance/binance/references/derivatives-portfolio-margin-pro-streams.md +5 -0
  44. package/skills/binance/binance/references/derivatives-portfolio-margin-pro.md +34 -0
  45. package/skills/binance/binance/references/derivatives-portfolio-margin-streams.md +5 -0
  46. package/skills/binance/binance/references/derivatives-portfolio-margin.md +146 -0
  47. package/skills/binance/binance/references/dual-investment.md +15 -0
  48. package/skills/binance/binance/references/fiat.md +9 -0
  49. package/skills/binance/binance/references/futures-coin-streams.md +29 -0
  50. package/skills/binance/binance/references/futures-coin.md +109 -0
  51. package/skills/binance/binance/references/futures-usds-streams.md +35 -0
  52. package/skills/binance/binance/references/futures-usds.md +144 -0
  53. package/skills/binance/binance/references/gift-card.md +10 -0
  54. package/skills/binance/binance/references/margin-trading-streams.md +6 -0
  55. package/skills/binance/binance/references/margin-trading.md +101 -0
  56. package/skills/binance/binance/references/mining.md +17 -0
  57. package/skills/binance/binance/references/pay.md +5 -0
  58. package/skills/binance/binance/references/rebate.md +5 -0
  59. package/skills/binance/binance/references/simple-earn.md +56 -0
  60. package/skills/binance/binance/references/spot-streams.md +25 -0
  61. package/skills/binance/binance/references/spot.md +114 -0
  62. package/skills/binance/binance/references/staking.md +59 -0
  63. package/skills/binance/binance/references/sub-account.md +67 -0
  64. package/skills/binance/binance/references/vip-loan.md +27 -0
  65. package/skills/binance/binance/references/wallet.md +75 -0
  66. package/skills/binance/fiat/CHANGELOG.md +11 -0
  67. package/skills/binance/fiat/LICENSE.md +9 -0
  68. package/skills/binance/fiat/SKILL.md +169 -0
  69. package/skills/binance/fiat/references/authentication.md +126 -0
  70. package/skills/binance/fiat/references/sapi-endpoints.md +217 -0
  71. package/skills/binance/onchain-pay/.local.md.example +10 -0
  72. package/skills/binance/onchain-pay/CHANGELOG.md +20 -0
  73. package/skills/binance/onchain-pay/LICENSE.md +9 -0
  74. package/skills/binance/onchain-pay/SKILL.md +466 -0
  75. package/skills/binance/onchain-pay/references/authentication.md +92 -0
  76. package/skills/binance/onchain-pay/scripts/sign_and_call.sh +52 -0
  77. package/skills/binance/p2p/CHANGELOG.md +33 -0
  78. package/skills/binance/p2p/LICENSE.md +9 -0
  79. package/skills/binance/p2p/SKILL.md +1082 -0
  80. package/skills/binance/p2p/references/agent-sapi-api.md +795 -0
  81. package/skills/binance/p2p/references/authentication.md +100 -0
  82. package/skills/binance/payment/SKILL.md +824 -0
  83. package/skills/binance/payment/common.py +560 -0
  84. package/skills/binance/payment/payment_skill.py +86 -0
  85. package/skills/binance/payment/receive.py +109 -0
  86. package/skills/binance/payment/references/setup-guide.md +77 -0
  87. package/skills/binance/payment/requirements.txt +4 -0
  88. package/skills/binance/payment/send.py +952 -0
  89. package/skills/binance/payment/send_extension/__init__.py +43 -0
  90. package/skills/binance/payment/send_extension/base.py +48 -0
  91. package/skills/binance/payment/send_extension/c2c.py +193 -0
  92. package/skills/binance/payment/send_extension/pix.py +316 -0
  93. package/skills/binance/square-post/README.md +62 -0
  94. package/skills/binance/square-post/SKILL.md +171 -0
  95. package/skills/binance/square-post/scripts/lib.mjs +175 -0
  96. package/skills/binance/square-post/scripts/post-image.mjs +80 -0
  97. package/skills/binance/square-post/scripts/post-text.mjs +41 -0
  98. package/skills/binance/square-post/scripts/post-video.mjs +110 -0
  99. package/skills/binance/square-post/scripts/save-key.mjs +34 -0
  100. package/skills/binance-web3/binance-agentic-wallet/SKILL.md +150 -0
  101. package/skills/binance-web3/binance-agentic-wallet/references/authentication.md +136 -0
  102. package/skills/binance-web3/binance-agentic-wallet/references/limit-order.md +204 -0
  103. package/skills/binance-web3/binance-agentic-wallet/references/market-order.md +179 -0
  104. package/skills/binance-web3/binance-agentic-wallet/references/prediction.md +489 -0
  105. package/skills/binance-web3/binance-agentic-wallet/references/preflight.md +66 -0
  106. package/skills/binance-web3/binance-agentic-wallet/references/security.md +47 -0
  107. package/skills/binance-web3/binance-agentic-wallet/references/send.md +53 -0
  108. package/skills/binance-web3/binance-agentic-wallet/references/wallet-setting.md +86 -0
  109. package/skills/binance-web3/binance-agentic-wallet/references/wallet-view.md +312 -0
  110. package/skills/binance-web3/binance-agentic-wallet/references/x402-payment.md +259 -0
  111. package/skills/binance-web3/binance-tokenized-securities-info/SKILL.md +613 -0
  112. package/skills/binance-web3/crypto-market-rank/SKILL.md +91 -0
  113. package/skills/binance-web3/crypto-market-rank/references/cli.md +219 -0
  114. package/skills/binance-web3/crypto-market-rank/scripts/cli.mjs +149 -0
  115. package/skills/binance-web3/meme-rush/SKILL.md +72 -0
  116. package/skills/binance-web3/meme-rush/references/cli.md +158 -0
  117. package/skills/binance-web3/meme-rush/scripts/cli.mjs +101 -0
  118. package/skills/binance-web3/query-address-info/SKILL.md +61 -0
  119. package/skills/binance-web3/query-address-info/references/cli.md +56 -0
  120. package/skills/binance-web3/query-address-info/scripts/cli.mjs +132 -0
  121. package/skills/binance-web3/query-token-audit/SKILL.md +162 -0
  122. package/skills/binance-web3/query-token-info/SKILL.md +83 -0
  123. package/skills/binance-web3/query-token-info/references/cli.md +135 -0
  124. package/skills/binance-web3/query-token-info/scripts/cli.mjs +112 -0
  125. package/skills/binance-web3/trading-signal/SKILL.md +66 -0
  126. package/skills/binance-web3/trading-signal/references/cli.md +90 -0
  127. package/skills/binance-web3/trading-signal/scripts/cli.mjs +92 -0
  128. package/skills/four-meme/four-guard/API-Contract-TaxToken.md +277 -0
  129. package/skills/four-meme/four-guard/API-CreateToken.02-02-2026.md +285 -0
  130. package/skills/four-meme/four-guard/API-Documents.03-03-2026.md +789 -0
  131. package/skills/four-meme/four-guard/AgentIdentifier.abi +585 -0
  132. package/skills/four-meme/four-guard/README.md +21 -0
  133. package/skills/four-meme/four-guard/SKILL.md +31 -0
  134. package/skills/four-meme/four-guard/TaxToken.abi +969 -0
  135. package/skills/four-meme/four-guard/TokenIdentifierSample.js_ +81 -0
  136. package/skills/four-meme/four-guard/TokenIdentifierSample.sol +69 -0
  137. package/skills/four-meme/four-guard/TokenManager.lite.abi +836 -0
  138. package/skills/four-meme/four-guard/TokenManager2.lite.abi +2325 -0
  139. package/skills/four-meme/four-guard/TokenManagerHelper3.abi +999 -0
  140. package/skills/four-meme/four-guard/go.mod +36 -0
  141. package/skills/four-meme/four-guard/go.sum +127 -0
  142. package/skills/four-meme/four-guard/main.go +183 -0
  143. package/skills/four-meme/four-meme-ai/SKILL.md +31 -0
  144. package/skills/four-meme/four-meme-ai/references/agent-creator-and-wallets.md +87 -0
  145. package/skills/four-meme/four-meme-ai/references/api-create-token.md +55 -0
  146. package/skills/four-meme/four-meme-ai/references/contract-addresses.md +47 -0
  147. package/skills/four-meme/four-meme-ai/references/create-token-scripts.md +131 -0
  148. package/skills/four-meme/four-meme-ai/references/errors.md +29 -0
  149. package/skills/four-meme/four-meme-ai/references/event-listening.md +75 -0
  150. package/skills/four-meme/four-meme-ai/references/execute-trade.md +31 -0
  151. package/skills/four-meme/four-meme-ai/references/tax-token-query.md +38 -0
  152. package/skills/four-meme/four-meme-ai/references/token-query-api.md +44 -0
  153. package/skills/four-meme/four-meme-ai/references/token-tax-info.md +77 -0
  154. package/skills/four-meme/four-meme-ai/scripts/8004-balance.ts +52 -0
  155. package/skills/four-meme/four-meme-ai/scripts/8004-register.ts +108 -0
  156. package/skills/four-meme/four-meme-ai/scripts/create-token-api.ts +321 -0
  157. package/skills/four-meme/four-meme-ai/scripts/create-token-chain.ts +102 -0
  158. package/skills/four-meme/four-meme-ai/scripts/create-token-instant.ts +106 -0
  159. package/skills/four-meme/four-meme-ai/scripts/execute-buy.ts +198 -0
  160. package/skills/four-meme/four-meme-ai/scripts/execute-sell.ts +150 -0
  161. package/skills/four-meme/four-meme-ai/scripts/get-public-config.ts +25 -0
  162. package/skills/four-meme/four-meme-ai/scripts/get-recent-events.ts +76 -0
  163. package/skills/four-meme/four-meme-ai/scripts/get-tax-token-info.ts +69 -0
  164. package/skills/four-meme/four-meme-ai/scripts/get-token-info.ts +94 -0
  165. package/skills/four-meme/four-meme-ai/scripts/quote-buy.ts +85 -0
  166. package/skills/four-meme/four-meme-ai/scripts/quote-sell.ts +66 -0
  167. package/skills/four-meme/four-meme-ai/scripts/send-token.ts +98 -0
  168. package/skills/four-meme/four-meme-ai/scripts/token-get.ts +31 -0
  169. package/skills/four-meme/four-meme-ai/scripts/token-list.ts +134 -0
  170. package/skills/four-meme/four-meme-ai/scripts/token-rankings.ts +162 -0
  171. package/skills/four-meme/four-meme-ai/scripts/verify-events.ts +47 -0
  172. package/skills/four-meme/four-meme-integration/SKILL.md +374 -0
  173. package/skills/four-meme/four-meme-integration/references/agent-creator-and-wallets.md +87 -0
  174. package/skills/four-meme/four-meme-integration/references/api-create-token.md +55 -0
  175. package/skills/four-meme/four-meme-integration/references/contract-addresses.md +47 -0
  176. package/skills/four-meme/four-meme-integration/references/create-token-scripts.md +131 -0
  177. package/skills/four-meme/four-meme-integration/references/errors.md +29 -0
  178. package/skills/four-meme/four-meme-integration/references/event-listening.md +75 -0
  179. package/skills/four-meme/four-meme-integration/references/execute-trade.md +31 -0
  180. package/skills/four-meme/four-meme-integration/references/tax-token-query.md +38 -0
  181. package/skills/four-meme/four-meme-integration/references/token-query-api.md +44 -0
  182. package/skills/four-meme/four-meme-integration/references/token-tax-info.md +77 -0
  183. package/skills/four-meme/four-meme-integration/scripts/8004-balance.ts +52 -0
  184. package/skills/four-meme/four-meme-integration/scripts/8004-register.ts +108 -0
  185. package/skills/four-meme/four-meme-integration/scripts/create-token-api.ts +321 -0
  186. package/skills/four-meme/four-meme-integration/scripts/create-token-chain.ts +102 -0
  187. package/skills/four-meme/four-meme-integration/scripts/create-token-instant.ts +106 -0
  188. package/skills/four-meme/four-meme-integration/scripts/execute-buy.ts +198 -0
  189. package/skills/four-meme/four-meme-integration/scripts/execute-sell.ts +150 -0
  190. package/skills/four-meme/four-meme-integration/scripts/get-public-config.ts +25 -0
  191. package/skills/four-meme/four-meme-integration/scripts/get-recent-events.ts +76 -0
  192. package/skills/four-meme/four-meme-integration/scripts/get-tax-token-info.ts +69 -0
  193. package/skills/four-meme/four-meme-integration/scripts/get-token-info.ts +94 -0
  194. package/skills/four-meme/four-meme-integration/scripts/quote-buy.ts +85 -0
  195. package/skills/four-meme/four-meme-integration/scripts/quote-sell.ts +66 -0
  196. package/skills/four-meme/four-meme-integration/scripts/send-token.ts +98 -0
  197. package/skills/four-meme/four-meme-integration/scripts/token-get.ts +31 -0
  198. package/skills/four-meme/four-meme-integration/scripts/token-list.ts +134 -0
  199. package/skills/four-meme/four-meme-integration/scripts/token-rankings.ts +162 -0
  200. package/skills/four-meme/four-meme-integration/scripts/verify-events.ts +47 -0
  201. package/skills/skillpp/contract-profiler/SKILL.md +118 -0
  202. package/skills/skillpp/newbie-tutor/SKILL.md +85 -0
  203. package/skills/skillpp/opportunity-board/SKILL.md +87 -0
  204. package/skills/skillpp/risk-fusion/SKILL.md +146 -0
  205. package/skills/skillpp/scam-pattern-lab/SKILL.md +115 -0
  206. package/skills/skillpp/wallet-doctor/SKILL.md +119 -0
  207. package/skills/skillpp/watchtower/SKILL.md +72 -0
  208. package/tests/compatibility/v0.1.0.json +117 -0
@@ -0,0 +1,131 @@
1
+ # Create Token Scripts (Four.meme)
2
+
3
+ **Recommended:** Use `fourmeme create-instant` for one-shot token creation (API + on-chain in one command). Use the step-by-step flow only when you need to inspect or modify the API output before submitting on-chain.
4
+
5
+ ## One-shot (create-instant) — recommended
6
+
7
+ **create-token-instant.ts** runs API create + on-chain submit in one command. Same args as create-token-api; on success submits createToken and outputs `txHash`.
8
+
9
+ - All options as `--key=value`; no positionals.
10
+ - **Required**: `--image=`, `--name=`, `--short-name=`, `--desc=`, `--label=`.
11
+ - **Optional**: `--web-url=`, `--twitter-url=`, `--telegram-url=` (only sent when non-empty); `--pre-sale=0` (**presale in ether units**, e.g. `0.001` for 0.001 BNB, not wei); `--fee-plan=false`, `--tax-options=<path>`; `--value=<wei>` (default to be auto calculated, override BNB value sent; otherwise API output `creationFeeWei` is used).
12
+ - **Tax token**: `--tax-options=tax.json` or `--tax-token` with `--tax-fee-rate=5` `--tax-burn-rate=0` `--tax-divide-rate=0` `--tax-liquidity-rate=100` `--tax-recipient-rate=0` `--tax-recipient-address=` `--tax-min-sharing=100000` (burn+divide+liquidity+recipient=100).
13
+ - **Label** (exactly one): `Meme` | `AI` | `Defi` | `Games` | `Infra` | `De-Sci` | `Social` | `Depin` | `Charity` | `Others`.
14
+ - **Env**: `PRIVATE_KEY`; RPC via `BSC_RPC_URL`.
15
+ - **Flow**: nonce → login → upload image → GET public config → POST create → submit `TokenManager2.createToken` on BSC.
16
+ - **Output**: JSON `{ "txHash" }`.
17
+
18
+ ```bash
19
+ # Via CLI (recommended)
20
+ fourmeme create-instant --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI
21
+
22
+ # With presale (BNB, ether units)
23
+ fourmeme create-instant --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI --pre-sale=0.001
24
+
25
+ # Tax token
26
+ fourmeme create-instant --image=./logo.png --name=TaxToken --short-name=TAX --desc="Tax" --label=Meme --tax-options=tax.json
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Step-by-step flow (create-api → create-chain)
32
+
33
+ 1. **get-public-config.ts** (optional)
34
+ Fetches `raisedToken` from `https://four.meme/meme-api/v1/public/config`. Use when building the create body manually.
35
+
36
+ 2. **create-token-api.ts**
37
+ - All options as `--key=value`; no positionals.
38
+ - Required: `--image=`, `--name=`, `--short-name=`, `--desc=`, `--label=`.
39
+ - Optional: `--web-url=`, `--twitter-url=`, `--telegram-url=` (only sent when non-empty); `--pre-sale=0` (**presale in ether units**, e.g. `0.001` for 0.001 BNB, not wei); `--fee-plan=false`, `--tax-options=<path>`.
40
+ - Tax token: `--tax-options=tax.json` or `--tax-token` with `--tax-fee-rate=5` etc. (burn+divide+liquidity+recipient=100).
41
+ - Env: `PRIVATE_KEY`; RPC via `BSC_RPC_URL`.
42
+ - Flow: nonce → login → upload image → GET public config → POST create.
43
+ - Output: JSON `{ "createArg", "signature", "creationFeeWei" }`; script hints required value for chain step.
44
+
45
+ 3. **create-token-chain.ts**
46
+ - Env: `PRIVATE_KEY`.
47
+ - Input: `createArg`, `signature` (positional or stdin JSON with `--`).
48
+ - Optional (CLI overrides env): `--value=<wei>` (env `CREATION_FEE_WEI`). RPC via env `BSC_RPC_URL`.
49
+ - Calls `TokenManager2.createToken(createArg, sign)`; excess BNB is refunded by the contract.
50
+
51
+ ## createToken value (CREATION_FEE_WEI) formula
52
+
53
+ **Formula**
54
+
55
+ - **No presale (or quote is ERC20)**
56
+ `value = launch_fee`
57
+ `launch_fee`: read from TokenManager2 `_launchFee()` (wei).
58
+
59
+ - **With presale and quote is BNB**
60
+ `value = launch_fee + presale_wei + trading_fee`
61
+ - `presale_wei`: presale amount in wei (API sends preSale in BNB/ether; script converts to wei for value).
62
+ - `trading_fee`: see below.
63
+
64
+ **How to compute trading_fee**
65
+
66
+ - Contract uses basis-point rate: `trading_fee = presale_wei × fee_rate / 10000` (integer division).
67
+ - `fee_rate` from TokenManager2 `_tradingFeeRate()` (basis points).
68
+ - If the contract enforces a minimum fee per trade, use `max(computed trading_fee, minimum_fee)`.
69
+
70
+ ## Example (instant, recommended)
71
+
72
+ ```bash
73
+ export PRIVATE_KEY=your_hex_private_key
74
+ fourmeme create-instant --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI
75
+ ```
76
+
77
+ ## Example (piped)
78
+
79
+ ```bash
80
+ export PRIVATE_KEY=your_hex_private_key
81
+ npx tsx skills/four-meme-integration/scripts/create-token-api.ts --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI \
82
+ | npx tsx skills/four-meme-integration/scripts/create-token-chain.ts --
83
+ ```
84
+
85
+ The chain script reads `creationFeeWei` from stdin JSON when present; you can also pass `--value=<wei>` explicitly.
86
+
87
+ ## Example (two steps)
88
+
89
+ ```bash
90
+ export PRIVATE_KEY=your_hex_private_key
91
+ npx tsx skills/four-meme-integration/scripts/create-token-api.ts --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI > create-out.json
92
+ npx tsx skills/four-meme-integration/scripts/create-token-chain.ts "$(jq -r .createArg create-out.json)" "$(jq -r .signature create-out.json)" --value=$(jq -r .creationFeeWei create-out.json)
93
+ ```
94
+
95
+ ## Example (with presale)
96
+
97
+ `--pre-sale` is in **ether units** (e.g. `0.001` = 0.001 BNB; do not pass wei).
98
+
99
+ ```bash
100
+ npx tsx .../create-token-api.ts --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI --pre-sale=0.01
101
+ ```
102
+
103
+ ## Tax token
104
+
105
+ Tax options file must contain `tokenTaxInfo`. Example **tax-options.json**:
106
+
107
+ ```json
108
+ {
109
+ "tokenTaxInfo": {
110
+ "feeRate": 5,
111
+ "burnRate": 20,
112
+ "divideRate": 30,
113
+ "liquidityRate": 40,
114
+ "recipientRate": 10,
115
+ "recipientAddress": "0x1234567890123456789012345678901234567890",
116
+ "minSharing": 100000
117
+ }
118
+ }
119
+ ```
120
+
121
+ `feeRate` must be 1, 3, 5, or 10; burn+divide+liquidity+recipient=100. See [token-tax-info.md](token-tax-info.md).
122
+
123
+ ```bash
124
+ # Option A: --tax-options= path to JSON file
125
+ npx tsx .../create-token-api.ts --image=./logo.png --name=TaxToken --short-name=TAX --desc="Tax token" --label=AI --tax-options=tax-options.json
126
+
127
+ # Option B: --tax-token with rate args
128
+ npx tsx .../create-token-api.ts --image=./logo.png --name=TaxToken --short-name=TAX --desc="Tax token" --label=AI --tax-token --tax-fee-rate=5 --tax-burn-rate=20 --tax-divide-rate=30 --tax-liquidity-rate=40 --tax-recipient-rate=10 --tax-recipient-address=0x... --tax-min-sharing=100000
129
+ ```
130
+
131
+ Chain and Labels: see [SKILL.md](../SKILL.md) or [api-create-token.md](api-create-token.md).
@@ -0,0 +1,29 @@
1
+ # Four.meme Error Codes
2
+
3
+ ## buyToken
4
+
5
+ | Code | Meaning |
6
+ |-----------|---------|
7
+ | GW (GWEI) | Amount precision not aligned to GWEI |
8
+ | ZA | Zero Address – `to` must not be address(0) |
9
+ | TO | Invalid to – `to` must not be PancakePair address |
10
+ | Slippage | Spent amount &gt; maxFunds |
11
+ | More BNB | Insufficient BNB in msg.value |
12
+ | A | X Mode token bought with wrong method – use X Mode buy |
13
+
14
+ ## sellToken
15
+
16
+ | Code | Meaning |
17
+ |----------|---------|
18
+ | GW (GWEI)| Amount precision not aligned to GWEI |
19
+ | FR (FeeRate) | Fee rate &gt; 5% |
20
+ | SO (Small Order) | Order amount too small |
21
+ | Slippage | Received amount &lt; minFunds |
22
+
23
+ ## Identification
24
+
25
+ - **X Mode (exclusive)**: Off-chain – API token info `version === "V8"`. On-chain – `TokenManager2._tokenInfos[token].template & 0x10000 > 0`.
26
+ - **TaxToken**: Off-chain – API response has `taxInfo`. On-chain – `(template >> 10) & 0x3F === 5`.
27
+ - **AntiSniperFeeMode**: Off-chain – API `feePlan === true`. On-chain – `TokenManager2._tokenInfoEx1s[token].feeSetting > 0`.
28
+ - **Token created by Agent Creator**: Off-chain – API `data.aiCreator === true`. On-chain – `(TokenManager2._tokenInfos[token].template & (1 << 85)) != 0`. Does not change trading behavior.
29
+ - **Agent wallets**: Call **AgentIdentifier.isAgent(wallet)** on BSC; see [agent-creator-and-wallets.md](agent-creator-and-wallets.md) and [contract-addresses.md](contract-addresses.md).
@@ -0,0 +1,75 @@
1
+ # Event listening (TokenManager2, V2 only)
2
+
3
+ Only **TokenManager2 (V2)** is supported. V1 is not supported. Contract address (BSC): `0x5c952063c7fc8610FFDB798152D69F0B9550762b`.
4
+
5
+ The agent can react to **token creation, buy/sell, and liquidity add** by listening to the events below (e.g. copy-trading).
6
+
7
+ ## Event list
8
+
9
+ | Event | Meaning | Main args |
10
+ |-----------------|-------------------|---------------------------------------------------------------------------|
11
+ | **TokenCreate** | New token created | `creator`, `token`, `requestId`, `name`, `symbol`, `totalSupply`, `launchTime`, `launchFee` |
12
+ | **TokenPurchase** | Buy | `token`, `account`, `price`, `amount`, `cost`, `fee`, `offers`, `funds` |
13
+ | **TokenSale** | Sell | `token`, `account`, `price`, `amount`, `cost`, `fee`, `offers`, `funds` |
14
+ | **LiquidityAdded** | Liquidity added | `base`, `offers`, `quote`, `funds` |
15
+
16
+ - **TokenCreate**: With `token` (new token address) and `requestId`, you can call Helper3 `getTokenInfo(token)` or execute buy/sell immediately.
17
+ - **TokenPurchase / TokenSale**: Use for copy-trading, stats, etc.; `token` is the token address, `account` is the buyer/seller.
18
+ - **LiquidityAdded**: `base` is the token address; the token has been added to the pool and can be traded on the DEX.
19
+
20
+ ## How to listen (viem)
21
+
22
+ ### Option 1: Poll historical blocks with `getLogs`
23
+
24
+ ```typescript
25
+ import { createPublicClient, http, parseAbiItem } from 'viem';
26
+ import { bsc } from 'viem/chains';
27
+
28
+ const TOKEN_MANAGER2 = '0x5c952063c7fc8610FFDB798152D69F0B9550762b';
29
+
30
+ const client = createPublicClient({
31
+ chain: bsc,
32
+ transport: http(process.env.BSC_RPC_URL || 'https://bsc-dataseed.binance.org'),
33
+ });
34
+
35
+ const logs = await client.getLogs({
36
+ address: TOKEN_MANAGER2,
37
+ events: [
38
+ parseAbiItem('event TokenCreate(address creator, address token, uint256 requestId, string name, string symbol, uint256 totalSupply, uint256 launchTime, uint256 launchFee)'),
39
+ parseAbiItem('event TokenPurchase(address token, address account, uint256 price, uint256 amount, uint256 cost, uint256 fee, uint256 offers, uint256 funds)'),
40
+ parseAbiItem('event TokenSale(address token, address account, uint256 price, uint256 amount, uint256 cost, uint256 fee, uint256 offers, uint256 funds)'),
41
+ parseAbiItem('event LiquidityAdded(address base, uint256 offers, address quote, uint256 funds)'),
42
+ ],
43
+ fromBlock: fromBlockNumber,
44
+ toBlock: toBlockNumber,
45
+ });
46
+ ```
47
+
48
+ ### Option 2: Real-time subscription with `watchContractEvent`
49
+
50
+ ```typescript
51
+ import { createPublicClient, http, parseAbiItem } from 'viem';
52
+ import { bsc } from 'viem/chains';
53
+
54
+ const client = createPublicClient({ chain: bsc, transport: http(rpcUrl) });
55
+
56
+ const unwatch = client.watchContractEvent({
57
+ address: TOKEN_MANAGER2,
58
+ events: [
59
+ parseAbiItem('event TokenCreate(address creator, address token, uint256 requestId, string name, string symbol, uint256 totalSupply, uint256 launchTime, uint256 launchFee)'),
60
+ parseAbiItem('event TokenPurchase(address token, address account, uint256 price, uint256 amount, uint256 cost, uint256 fee, uint256 offers, uint256 funds)'),
61
+ parseAbiItem('event TokenSale(address token, address account, uint256 price, uint256 amount, uint256 cost, uint256 fee, uint256 offers, uint256 funds)'),
62
+ parseAbiItem('event LiquidityAdded(address base, uint256 offers, address quote, uint256 funds)'),
63
+ ],
64
+ onLogs: (logs) => {
65
+ for (const log of logs) {
66
+ console.log(log.eventName, log.args);
67
+ }
68
+ },
69
+ });
70
+ // To stop: unwatch()
71
+ ```
72
+
73
+ ## Script
74
+
75
+ Use `fourmeme events <fromBlock> [toBlock]` (script `get-recent-events.ts`) to fetch the four event types in a block range and output JSON. See the events section in [SKILL.md](../SKILL.md).
@@ -0,0 +1,31 @@
1
+ # Execute Buy / Sell (Four.meme BSC)
2
+
3
+ Executes buy/sell (sends on-chain transactions). Requires `PRIVATE_KEY`. Only **TokenManager2 (V2)** tokens are supported.
4
+
5
+ ## Buy
6
+
7
+ - **By amount**: `buyToken(token, amount, maxFunds)`
8
+ CLI: `fourmeme buy <token> amount <amountWei> <maxFundsWei>`
9
+ Meaning: Spend at most `maxFundsWei` of quote (BNB or BEP20) to buy `amountWei` tokens.
10
+
11
+ - **By funds**: `buyTokenAMAP(token, funds, minAmount)`
12
+ CLI: `fourmeme buy <token> funds <fundsWei> <minAmountWei>`
13
+ Meaning: Spend `fundsWei` of quote and receive at least `minAmountWei` tokens.
14
+
15
+ If quote is BEP20 (not BNB), the script will `approve` TokenManager2 first, then send the buy transaction.
16
+
17
+ ## Sell
18
+
19
+ - Contract requirement: First `approve(tokenManager, amount)` on TokenManager2, then call `sellToken(token, amount)` or `sellToken(origin, token, amount, minFunds)` for slippage protection.
20
+ - The CLI runs approve then sell automatically; no need to do both manually.
21
+
22
+ ```bash
23
+ fourmeme sell <tokenAddress> <amountWei> [minFundsWei]
24
+ ```
25
+
26
+ - `minFundsWei` is optional: minimum quote to receive (slippage protection).
27
+
28
+ ## Relation to quote commands
29
+
30
+ - `quote-buy` / `quote-sell`: Read-only estimates; no transaction is sent.
31
+ - `buy` / `sell`: Actually send transactions. Recommended: use `quote-buy` / `quote-sell` first to get estimates, then choose `maxFundsWei`, `minAmountWei`, `minFundsWei` and call `buy` / `sell`.
@@ -0,0 +1,38 @@
1
+ # Query Tax Token fee/tax info
2
+
3
+ Only for **TaxToken** (creatorType 5). The token contract address is the TaxToken contract; call view functions on that address.
4
+
5
+ ## On-chain view functions (TaxToken.abi)
6
+
7
+ | Function / variable | Description | Unit / meaning |
8
+ |---------------------|-------------|----------------|
9
+ | **feeRate** | Trading fee rate | Basis points; 10000 = 100%, e.g. 500 = 5% |
10
+ | **rateFounder** | Founder allocation share | Percent; 100 = 100%, e.g. 10 = 10% |
11
+ | **rateHolder** | Holder dividend share | Same |
12
+ | **rateBurn** | Burn share | Same |
13
+ | **rateLiquidity** | Liquidity add share | Same; rateFounder + rateHolder + rateBurn + rateLiquidity = 100 |
14
+ | **minDispatch** | Cumulative fee threshold to trigger distribution | Token units |
15
+ | **minShare** | Min balance to participate in dividends | Token units (ether); below this, no dividend |
16
+ | **quote** | Quote token address | 0 = BNB/ETH |
17
+ | **founder** | Founder address | Receives founder allocation |
18
+
19
+ See also **claimableFee(account)**, **claimedFee(account)**, **userInfo(account)** for claimable/claimed fees and user info in the [official API/Contract docs](https://four-meme.gitbook.io/four.meme/brand/protocol-integration) (e.g. API-Contract-TaxToken).
20
+
21
+ ## Script
22
+
23
+ ```bash
24
+ npx fourmeme tax-info <tokenAddress>
25
+ ```
26
+
27
+ Or run: `npx tsx .../get-tax-token-info.ts <tokenAddress>`. BSC only.
28
+
29
+ Example output (JSON): `feeRateBps`, `feeRatePercent`, `rateFounder`, `rateHolder`, `rateBurn`, `rateLiquidity`, `minDispatch`, `minShare`, `quote`, `founder`.
30
+
31
+ ## How to identify a TaxToken
32
+
33
+ - **Off-chain**: Call four.meme API `GET /v1/private/token/get?address=<token>`; if response `data` contains `taxInfo`, it is a TaxToken.
34
+ - **On-chain**: In TokenManager2, `(template >> 10) & 0x3F === 5` means TaxToken. Or run `get-tax-token-info`; if it succeeds and e.g. `feeRateBps > 0`, treat as TaxToken.
35
+
36
+ ## References
37
+
38
+ - [Protocol Integration](https://four-meme.gitbook.io/four.meme/brand/protocol-integration) – API documents (API-Contract-TaxToken, etc.) and ABIs (TaxToken.abi)
@@ -0,0 +1,44 @@
1
+ # Token query REST API (Four.meme)
2
+
3
+ Base: `https://four.meme/meme-api/v1`. Requests need `Accept: application/json`; POST needs `Content-Type: application/json`. No login or cookie required.
4
+
5
+ ## 1. Token list (filter / paginate)
6
+
7
+ **POST** `/public/token/search`
8
+ JSON body: `type`, `listType`, `pageIndex`, `pageSize`, `status`, `sort`, optional `keyword`, `symbol`, `tag` (array), `version`.
9
+
10
+ | Parameter | Description |
11
+ |-----------|-------------|
12
+ | type | Ranking sort context: NEW, HOT, PROGRESS, VOL, LAST, CAP, DEX, BURN, … |
13
+ | listType | NOR, NOR_DEX, BIN, USD1, BIN_DEX, USD1_DEX, ADV |
14
+ | status | PUBLISH, TRADE, ALL |
15
+ | sort | DESC, ASC |
16
+ | keyword | Search keyword |
17
+ | symbol | Quote symbol (e.g. BNB, USDT) |
18
+ | tag | Label filters (e.g. Meme, AI) |
19
+ | version | V9 (tax), V10 (AI); omit for all |
20
+
21
+ CLI: `fourmeme token-list` — legacy flags still map to the above (e.g. `--orderBy` → `type`, `--tokenName` → `keyword`, `--labels` → `tag`, `--listedPancake=false` → `status=PUBLISH`). See script header for full list.
22
+
23
+ ## 2. Token detail and trading info
24
+
25
+ **GET** `/private/token/get/v2?address=<tokenAddress>`
26
+
27
+ CLI: `fourmeme token-get <tokenAddress>`
28
+
29
+ ## 3. Rankings
30
+
31
+ **POST** `/public/token/ranking`
32
+ JSON body: `type` (required RankingType), `pageSize`, optional `rankingKind`, `version`, `symbol`, `minCap`, `maxCap`, `minVol`, `maxVol`, `minHold`, `maxHold`.
33
+
34
+ | Legacy CLI orderBy | Maps to type |
35
+ |--------------------|--------------|
36
+ | Time | NEW |
37
+ | ProgressDesc | PROGRESS |
38
+ | TradingDesc | VOL_DAY_1 (default); `--barType` selects VOL_HOUR_1, VOL_HOUR_4, VOL_MIN_30, VOL_MIN_5, … |
39
+ | Hot | HOT |
40
+ | Graduated | DEX |
41
+
42
+ You may also pass a native `type` as the first argument (e.g. `VOL_DAY_1`, `CAP`, `BURN`).
43
+
44
+ CLI: `fourmeme token-rankings <orderBy|type> [--barType=HOUR24] [--pageSize=20] [--symbol=] [--version=] …`
@@ -0,0 +1,77 @@
1
+ # Tax Token parameters (tokenTaxInfo)
2
+
3
+ When creating a **Tax-type token**, send a `tokenTaxInfo` object in the create request body. If omitted, a normal token is created. Agent interaction (whether to create a tax token, parameter order) is in [SKILL.md](../SKILL.md) “Create token (full flow)”. This page only lists fields and constraints.
4
+
5
+ ## Field summary
6
+
7
+ | Parameter | Type | Description | Allowed values / constraint |
8
+ |-----------|------|-------------|------------------------------|
9
+ | **feeRate** | number | Trading fee rate (%) | **Exactly one of**: `1`, `3`, `5`, `10` |
10
+ | **burnRate** | number | Burn share (%) | Custom; see constraints below |
11
+ | **divideRate** | number | Dividend share (%) | Custom; see below |
12
+ | **liquidityRate** | number | Liquidity share (%) | Custom; see below |
13
+ | **recipientRate** | number | Recipient share (%) | Custom; use `0` if not used |
14
+ | **recipientAddress** | string | Address that receives allocation | Use `""` if not used |
15
+ | **minSharing** | number | Min balance for dividends (ether units) | Must satisfy `d × 10ⁿ`, n≥5, 1≤d≤9 |
16
+
17
+ ## Constraints
18
+
19
+ 1. **feeRate** must be one of **1, 3, 5, 10** (1%, 3%, 5%, 10%).
20
+ 2. **burnRate + divideRate + liquidityRate + recipientRate = 100** (the four shares must sum to 100).
21
+ 3. If no recipient: **recipientAddress = ""** and **recipientRate = 0**.
22
+ 4. **minSharing** examples: `100000` (1×10⁵), `200000`, `500000`, `1000000` (1×10⁶), `9000000`, `10000000` (1×10⁷), i.e. `d × 10ⁿ` with n≥5, 1≤d≤9.
23
+
24
+ ## Examples
25
+
26
+ **Example 1: 5% fee, 20% burn, 30% dividend, 40% liquidity, 10% recipient**
27
+
28
+ ```json
29
+ {
30
+ "tokenTaxInfo": {
31
+ "feeRate": 5,
32
+ "burnRate": 20,
33
+ "divideRate": 30,
34
+ "liquidityRate": 40,
35
+ "recipientRate": 10,
36
+ "recipientAddress": "0x1234567890123456789012345678901234567890",
37
+ "minSharing": 100000
38
+ }
39
+ }
40
+ ```
41
+
42
+ **Example 2: 3% fee, 100% liquidity, no dividend/burn/recipient**
43
+
44
+ ```json
45
+ {
46
+ "tokenTaxInfo": {
47
+ "feeRate": 3,
48
+ "burnRate": 0,
49
+ "divideRate": 0,
50
+ "liquidityRate": 100,
51
+ "recipientRate": 0,
52
+ "recipientAddress": "",
53
+ "minSharing": 100000
54
+ }
55
+ }
56
+ ```
57
+
58
+ **Example 3: 10% fee, 50% dividend, 50% burn, min share 1×10⁶**
59
+
60
+ ```json
61
+ {
62
+ "tokenTaxInfo": {
63
+ "feeRate": 10,
64
+ "burnRate": 50,
65
+ "divideRate": 50,
66
+ "liquidityRate": 0,
67
+ "recipientRate": 0,
68
+ "recipientAddress": "",
69
+ "minSharing": 1000000
70
+ }
71
+ }
72
+ ```
73
+
74
+ ## Use in scripts
75
+
76
+ - **Option 1 (recommended)**: Write the above `tokenTaxInfo` to a JSON file (can contain only `tokenTaxInfo`) and pass that file path as the last argument to `create-token-api.ts`; the script merges it into the create body.
77
+ - **Option 2**: Build tax params via env vars (see “Create token (API)” optional env in SKILL.md).
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * EIP-8004 NFT – query balance (number of identity NFTs owned by address).
4
+ *
5
+ * Usage:
6
+ * npx tsx 8004-balance.ts <ownerAddress>
7
+ *
8
+ * Optional env: BSC_RPC_URL, 8004_NFT_ADDRESS.
9
+ * Default contract: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 (BSC).
10
+ */
11
+
12
+ import { createPublicClient, http, parseAbi } from 'viem';
13
+ import { bsc } from 'viem/chains';
14
+
15
+ const DEFAULT_8004_NFT = '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432' as const;
16
+
17
+ const ABI = parseAbi(['function balanceOf(address owner) view returns (uint256)']);
18
+
19
+ function isAddress(s: string): boolean {
20
+ return /^0x[0-9a-fA-F]{40}$/.test(s);
21
+ }
22
+
23
+ async function main() {
24
+ const ownerAddress = process.argv[2];
25
+ if (!ownerAddress || !isAddress(ownerAddress)) {
26
+ console.error('Usage: 8004-balance.ts <ownerAddress>');
27
+ console.error(' ownerAddress: 0x... wallet address');
28
+ process.exit(1);
29
+ }
30
+
31
+ const contractAddress = (process.env['8004_NFT_ADDRESS'] || process.env.EIP8004_NFT_ADDRESS || DEFAULT_8004_NFT) as `0x${string}`;
32
+ const rpcUrl = process.env.BSC_RPC_URL || 'https://bsc-dataseed.binance.org';
33
+
34
+ const client = createPublicClient({
35
+ chain: bsc,
36
+ transport: http(rpcUrl),
37
+ });
38
+
39
+ const balance = await client.readContract({
40
+ address: contractAddress,
41
+ abi: ABI,
42
+ functionName: 'balanceOf',
43
+ args: [ownerAddress as `0x${string}`],
44
+ });
45
+
46
+ console.log(JSON.stringify({ owner: ownerAddress, balance: Number(balance) }, null, 2));
47
+ }
48
+
49
+ main().catch((e) => {
50
+ console.error(e.message || e);
51
+ process.exit(1);
52
+ });
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * EIP-8004 NFT – register agent (mint identity NFT).
4
+ * Builds agentURI as data:application/json;base64,<payload> and calls contract.register(agentURI).
5
+ *
6
+ * Usage:
7
+ * npx tsx 8004-register.ts <name> [imageUrl] [description]
8
+ * - name: required
9
+ * - imageUrl: optional (URL string)
10
+ * - description: optional
11
+ *
12
+ * Env: PRIVATE_KEY. Optional: BSC_RPC_URL, 8004_NFT_ADDRESS.
13
+ * Default contract: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 (BSC).
14
+ */
15
+
16
+ import { createPublicClient, createWalletClient, decodeEventLog, http, parseAbi } from 'viem';
17
+ import { privateKeyToAccount } from 'viem/accounts';
18
+ import { bsc } from 'viem/chains';
19
+
20
+ const DEFAULT_8004_NFT = '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432' as const;
21
+
22
+ const REGISTRATION_TYPE = 'https://eips.ethereum.org/EIPS/eip-8004#registration-v1';
23
+
24
+ const ABI = parseAbi([
25
+ 'function register(string agentURI) returns (uint256 agentId)',
26
+ 'event Registered(uint256 indexed agentId, string agentURI, address indexed owner)',
27
+ ]);
28
+
29
+ function buildAgentURI(name: string, imageUrl: string, description: string): string {
30
+ const payload = {
31
+ type: REGISTRATION_TYPE,
32
+ name: name || '',
33
+ description: description || 'I\'m four.meme trading agent',
34
+ image: imageUrl || '',
35
+ active: true,
36
+ supportedTrust: [''],
37
+ };
38
+ const json = JSON.stringify(payload);
39
+ const base64 = Buffer.from(json, 'utf8').toString('base64');
40
+ return `data:application/json;base64,${base64}`;
41
+ }
42
+
43
+ async function main() {
44
+ const privateKey = process.env.PRIVATE_KEY;
45
+ if (!privateKey) {
46
+ console.error('Set PRIVATE_KEY');
47
+ process.exit(1);
48
+ }
49
+ const pk = privateKey.startsWith('0x') ? (privateKey as `0x${string}`) : (`0x${privateKey}` as `0x${string}`);
50
+ const account = privateKeyToAccount(pk);
51
+
52
+ const name = process.argv[2];
53
+ const imageUrl = process.argv[3] ?? '';
54
+ const description = process.argv[4] ?? '';
55
+
56
+ if (!name || name.trim() === '') {
57
+ console.error('Usage: 8004-register.ts <name> [imageUrl] [description]');
58
+ console.error(' name: required. imageUrl and description are optional.');
59
+ process.exit(1);
60
+ }
61
+
62
+ const agentURI = buildAgentURI(name.trim(), imageUrl.trim(), description.trim());
63
+ const contractAddress = (process.env['8004_NFT_ADDRESS'] || process.env.EIP8004_NFT_ADDRESS || DEFAULT_8004_NFT) as `0x${string}`;
64
+ const rpcUrl = process.env.BSC_RPC_URL || 'https://bsc-dataseed.binance.org';
65
+
66
+ const wallet = createWalletClient({
67
+ account,
68
+ chain: bsc,
69
+ transport: http(rpcUrl),
70
+ });
71
+ const publicClient = createPublicClient({
72
+ chain: bsc,
73
+ transport: http(rpcUrl),
74
+ });
75
+
76
+ const txHash = await wallet.writeContract({
77
+ address: contractAddress,
78
+ abi: ABI,
79
+ functionName: 'register',
80
+ args: [agentURI],
81
+ });
82
+
83
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
84
+ let agentId: number | null = null;
85
+ for (const l of receipt.logs) {
86
+ if (l.address.toLowerCase() !== contractAddress.toLowerCase()) continue;
87
+ try {
88
+ const d = decodeEventLog({
89
+ abi: ABI,
90
+ data: l.data,
91
+ topics: l.topics,
92
+ });
93
+ if (d.eventName === 'Registered') {
94
+ agentId = Number((d.args as { agentId: bigint }).agentId);
95
+ break;
96
+ }
97
+ } catch {
98
+ /* ignore */
99
+ }
100
+ }
101
+
102
+ console.log(JSON.stringify({ txHash, agentId, agentURI }, null, 2));
103
+ }
104
+
105
+ main().catch((e) => {
106
+ console.error(e.message || e);
107
+ process.exit(1);
108
+ });