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,789 @@
1
+ # Table of Contents
2
+
3
+ - [CHANGES](#changes)
4
+ - [03/03/2026](#changes---03032026)
5
+ - [30/01/2026](#changes---30012026)
6
+ - [30/10/2025](#changes---30102025)
7
+ - [09/10/2025](#changes---09102025)
8
+ - [14/06/2025](#changes---14062025)
9
+ - [17/03/2025](#changes---17032025)
10
+ - [18/02/2025](#changes---18022025)
11
+ - [01/02/2025](#changes---01022025)
12
+ - [01/10/2024](#changes---01102024)
13
+ - [19/09/2024](#changes---19092024)
14
+ - [Protocol Interfaces](#protocol-interfaces)
15
+ - [TokenManager (V1)](#tokenmanager-v1)
16
+ - [Methods](#methods)
17
+ - [Events](#events)
18
+ - [TokenManager2 (V2)](#tokenmanager2-v2)
19
+ - [Methods](#methods-1)
20
+ - [Events](#events-1)
21
+ - [TokenManagerHelper3 (V3)](#tokenmanagerhelper3-v3)
22
+ - [Methods](#methods-2)
23
+ - [FAQ](#faq)
24
+ - [Error Codes](#error-codes)
25
+ - [buyToken Errors](#buytoken-errors)
26
+ - [sellToken Errors](#selltoken-errors)
27
+ - [How to Identify X Mode Exclusive Tokens](#how-to-identify-x-mode-exclusive-tokens)
28
+ - [Off-chain](#1-off-chain)
29
+ - [On-chain](#2-on-chain)
30
+ - [How to Identify TaxToken](#how-to-identify-taxtoken)
31
+ - [On-chain Method](#on-chain-method)
32
+ - [Off-chain Method](#off-chain-method)
33
+ - [How to Identify AntiSniperFeeMode Tokens](#how-to-identify-antisniperfeemode-tokens)
34
+ - [On-chain Method](#on-chain-method-1)
35
+ - [Off-chain Method](#off-chain-method-1)
36
+ - [How to Identify Token Created By Agent Creator](#how-to-identify-token-created-by-agent-creator)
37
+ - [On-chain Method](#on-chain-method-2)
38
+ - [Off-chain Method](#off-chain-method-2)
39
+ - [How to Identify Agent Wallets](#how-to-identify-agent-wallets)
40
+ - [On-chain Method](#on-chain-method-3)
41
+
42
+ ---
43
+
44
+ # CHANGES - 03/03/2026
45
+
46
+ ## FAQ Updates
47
+ - added guide **How to Identify Token Created By Agent Creator**
48
+ - added guide **How to Identify Agent Wallets** and documented the `AgentIdentifier` contract (address and ABI)
49
+
50
+ # CHANGES - 30/01/2026
51
+
52
+ ## TokenManager2 (V2)
53
+ - added new TaxToken mode and the abi file of TaxToken.
54
+ - added AntiSniperFeeMode for all tokens
55
+ - added guides to identify TaxToken and AntiSniperFeeMode
56
+ - updated the abi file of TokenManager2
57
+
58
+ # CHANGES - 30/10/2025
59
+
60
+ ## TokenManager2 (V2)
61
+ - rebranded the Binance MPC Wallet only Mode (Fair Mode) to X Mode, and allow everyone to buy exclusive tokens in X Mode.
62
+ - added method `buyToken(bytes args, uint256 time, bytes signature)` to support buying X Mode exclusive tokens.
63
+
64
+ # CHANGES - 09/10/2025
65
+
66
+ ## FAQ Updates
67
+ - added support for identifying tokens that can only be traded with the Binance MPC Wallet. We recommend that third parties filter out these tokens. See FAQ for details.
68
+
69
+ # CHANGES - 14/06/2025
70
+
71
+ ## TokenManagerHelper3(V3)
72
+ - added methods `buyWithEth` `sellForEth`s to support direct use of BNB to purchase ERC20 pairs, automatically exchanging BNB between ERC20.
73
+
74
+ # CHANGES - 17/03/2025
75
+
76
+ ## TokenManager1(V1)
77
+
78
+ - added a method `function purchaseToken(uint256 origin, address token, address to, uint256 amount, uint256 maxFunds)`
79
+ - added a method `function purchaseTokenAMAP(uint256 origin, address token, address to, uint256 funds, uint256 minAmount) payable`
80
+
81
+
82
+ # CHANGES - 18/02/2025
83
+
84
+ ## TokenManager2(V2)
85
+
86
+ - added a method `sellToken(origin, token, amount, minFunds, feeRate, feeRecipient)` to support setting fee recipient
87
+ - added a method `sellToken(origin, token, from, amount, minFunds, feeRate, feeRecipient)` to support routers call
88
+
89
+
90
+ # CHANGES - 01/02/2025
91
+
92
+ ## TokenManagerHelper3(V3)
93
+ - change contract address to below:
94
+
95
+ - BSC: 0xF251F83e40a78868FcfA3FA4599Dad6494E46034
96
+
97
+ - Arbitrum One: 0x02287dc3CcA964a025DAaB1111135A46C10D3A57
98
+
99
+ - Base: 0x1172FABbAc4Fe05f5a5Cebd8EBBC593A76c42399
100
+
101
+ - change the method `tryBuy` to support new features
102
+ - TokenManagerHelper V1/V2 should be upgraded to V3
103
+
104
+
105
+ # CHANGES - 01/10/2024
106
+
107
+ ## TokenManagerHelper2(V2)
108
+
109
+ - change contract address to `0x79c7909097a2a5cedb8da900e3192cee671521a6`
110
+ - bug fixes for the method `tryBuy`
111
+
112
+ # CHANGES - 19/09/2024
113
+
114
+ ## TokenManager(V1) & TokenManager2(V2)
115
+
116
+ - These smart contracts are designed for creating new tokens and executing trades.
117
+ - The old TokenManager (referred to as V1) still functions for trading tokens that have already been created but cannot create new tokens; It is only used to support the buying and selling of tokens created before the TokenManager2 (referred to as V2) deployment.
118
+ - If full support four.meme is needed, both TokenManager V1 and V2 should be supported.
119
+ - If you only wish to support tokens created after September 5, 2024, then only V2 TokenManager needs to be supported.
120
+ - The method for simultaneously supporting both V1 and V2 TokenManagers is as follows:
121
+ - First, use the TokenManagerHelper method getTokenInfo to get the token information.
122
+ - Check information if the token was created by V1 that the tradings should be processed through the interfaces of old V1 TokenManager. Otherwise, use the V2 version.
123
+ - If pre-calculations of trading are needed, call helper methods.
124
+
125
+ ## TokenManagerHelper3 (V3)
126
+
127
+ - This smart contract is a wrapper of the TokenManagers. It is designed for getting token information and performing pre-calculations easily.
128
+ - The old TokenManagerHelper (referred to as V1/V2) still works but we have provided a new TokenManagerHelper3 (referred to as V3) contract that unifies the information query interfaces for both V1 TokenManager and V3 TokenManager.
129
+ - We recommend users who have previously used V1/V2 helper to migrate to V3 helper. it supports tokens created by both TokenManager V1 and V2.
130
+
131
+
132
+ # Protocol Interfaces
133
+ # TokenManager (V1)
134
+
135
+ This smart contract is mainly used to create new tokens and execute trades. Support tokens created before September 5, 2024.
136
+
137
+ **Address on BSC**
138
+
139
+ `0xEC4549caDcE5DA21Df6E6422d448034B5233bFbC`
140
+
141
+ **ABI File**
142
+
143
+ `TokenManager.lite.abi`
144
+
145
+ ## Methods
146
+
147
+ - **`purchaseTokenAMAP(address token, uint256 funds, uint256 minAmount)`**
148
+
149
+ If the user wants to buy a specific amount of BNB worth of tokens.
150
+
151
+ - `token`: Token address
152
+ - `funds`: Amount of BNB
153
+ - `minAmount`: Minimum amount of tokens to be purchased if the price changes
154
+ - **`purchaseToken(address token, uint256 amount, uint256 maxFunds)`**
155
+
156
+ If the user wants to buy a specific amount of tokens.
157
+
158
+ - `token`: Token address
159
+ - `amount`: Amount of tokens
160
+ - `maxFunds`: Maximum amount of BNB to be spent if the price changes
161
+
162
+ - **`function purchaseTokenAMAP(uint256 origin, address token, address to, uint256 funds, uint256 minAmount)`**
163
+ If the user wants to buy a specific amount of BNB worth of tokens for another recipient.
164
+
165
+ - `origin`: pass default 0
166
+ - `token`: Token address
167
+ - `to`: Specific recipient of the token
168
+ - `funds`: Amount of BNB
169
+ - `minAmount`: Minimum amount of tokens to be purchased if the price changes
170
+
171
+ - **`purchaseToken(uint256 origin, address token, address to, uint256 amount, uint256 maxFunds)`**
172
+ If the user wants to buy a specific amount of tokens for another recipient.
173
+
174
+ - `origin`: pass default 0
175
+ - `token`: Token address
176
+ - `to`: Specific recipient of the token
177
+ - `amount`: Amount of tokens
178
+ - `maxFunds`: Maximum amount of BNB to be spent if the price changes
179
+
180
+ - **`saleToken(address token, uint256 amount)`**
181
+
182
+ If the user wants to sell tokens.
183
+
184
+ - `token`: Token address
185
+ - `amount`: Amount of tokens
186
+
187
+ ## Events
188
+
189
+ - **`TokenCreate(address creator, address token, uint256 requestId, string name, string symbol, uint256 totalSupply, uint256 launchTime)`**
190
+
191
+ Emitted when a new token is created.
192
+
193
+ - `creator`: Address of the token creator
194
+ - `token`: Address of the created token
195
+ - `requestId`: Unique identifier for the token creation request
196
+ - `name`: Name of the token
197
+ - `symbol`: Symbol of the token
198
+ - `totalSupply`: Total supply of the token
199
+ - `launchTime`: Launch time of the token
200
+ - **`TokenPurchase(address token, address account, uint256 tokenAmount, uint256 etherAmount)`**
201
+
202
+ Emitted when tokens are purchased.
203
+
204
+ - `token`: Address of the token purchased
205
+ - `account`: Address of the buyer
206
+ - `tokenAmount`: Amount of tokens purchased
207
+ - `etherAmount`: Amount of BNB spent on the purchase
208
+ - **`TokenSale(address token, address account, uint256 tokenAmount, uint256 etherAmount)`**
209
+
210
+ Emitted when tokens are sold.
211
+
212
+ - `token`: Address of the token sold
213
+ - `account`: Address of the seller
214
+ - `tokenAmount`: Amount of tokens sold
215
+ - `etherAmount`: Amount of BNB received from the sale
216
+
217
+ # TokenManager2 (V2)
218
+
219
+ TokenManager2 is V2 of TokenManager, which is a significant upgrade that now supports the features of purchasing tokens using both BNB and BEP20. Support tokens created after September 5, 2024.
220
+
221
+ **Address on BSC**
222
+
223
+ `0x5c952063c7fc8610FFDB798152D69F0B9550762b`
224
+
225
+ **ABI File**
226
+
227
+ `TokenManager2.lite.abi`
228
+
229
+ ## Methods
230
+
231
+ - **`buyTokenAMAP(address token, uint256 funds, uint256 minAmount)`**
232
+
233
+ If the user wants to buy a specific amount of quote worth of tokens for msg.sender.
234
+
235
+ - `token`: Token address
236
+ - `funds`: Amount of quote
237
+ - `minAmount`: Minimum amount of tokens to be purchased if the price changes
238
+ - **`buyTokenAMAP(address token, address to, uint256 funds, uint256 minAmount)`**
239
+
240
+ If the user wants to buy a specific amount of quote worth of tokens for another recipient.
241
+
242
+ - `token`: Token address
243
+ - `to`: Specific recipient of the token
244
+ - `funds`: Amount of quote
245
+ - `minAmount`: Minimum amount of tokens to be purchased if the price changes
246
+ - **`buyToken(address token, uint256 amount, uint256 maxFunds)`**
247
+
248
+ If the user wants to buy a specific amount of tokens for msg.sender.
249
+
250
+ - `token`: Token address
251
+ - `amount`: Amount of tokens
252
+ - `maxFunds`: Maximum amount of quote that could be spent if the price changes
253
+ - **`buyToken(address token, address to, uint256 amount, uint256 maxFunds)`**
254
+
255
+ If the user wants to buy a specific amount of tokens for another recipient.
256
+
257
+ - `token`: Token address
258
+ - `to`: Recipient of the token
259
+ - `amount`: Amount of tokens
260
+ - `maxFunds`: Maximum amount of quote that could be spent if the price changes
261
+ - **`sellToken(address token, uint256 amount)`**
262
+
263
+ If the user wants to sell tokens.
264
+
265
+ - `token`: Token address
266
+ - `amount`: Amount of tokens
267
+
268
+
269
+ - **`sellToken(uint256 origin, address token, uint256 amount, uint256 minFunds, uint256 feeRate, address feeRecipient)`**
270
+
271
+ If the user wants to sell tokens with a third-party fee recipient.
272
+
273
+ - `origin`: Set 0
274
+ - `token`: The address of the token to be sold.
275
+ - `amount`: The amount of tokens to be sold.
276
+ - `minFunds`: The minimum amount of funds to be received after the sale.
277
+ - `feeRate`: The router's fee rate. 100 means 1%, and 10 means 0.1%. (MAX 5%)
278
+ - `feeRecipient`: The address that will receive the fee.
279
+
280
+ - **`sellToken(uint256 origin, address token, address from, uint256 amount, uint256 minFunds, uint256 feeRate, address feeRecipient)`**
281
+
282
+ If the user wants to sell tokens through a third-party router, the original sender of the transaction must be the token owner.
283
+
284
+ - `origin`: Set 0
285
+ - `token`: The address of the token to be sold.
286
+ - `from`: The address of the token owner(tx.origin == from).
287
+ - `amount`: The amount of tokens to be sold.
288
+ - `minFunds`: The minimum amount of funds to be received after the sale.
289
+ - `feeRate`: The router's fee rate. 100 means 1%, and 10 means 0.1%. (MAX 5%)
290
+ - `feeRecipient`: The address that will receive the fee.
291
+
292
+ - Before calling `sellToken`, the token owner has to approve first `ERC20.approve(tokenManager, amount)`.
293
+
294
+ - **`buyToken(bytes args, uint256 time, bytes signature) public payable nonReentrant`**
295
+
296
+ Encoded-params buy interface for tokens in X Mode.
297
+
298
+ - `args`: abi.encode `BuyTokenParams`
299
+
300
+ ```solidity
301
+ struct BuyTokenParams {
302
+ uint256 origin;
303
+ address token;
304
+ address to;
305
+ uint256 amount;
306
+ uint256 maxFunds;
307
+ uint256 funds;
308
+ uint256 minAmount;
309
+ }
310
+ ```
311
+ - `origin`: Set 0
312
+ - `token`: The address of the token to purchase
313
+ - `to`: The recipient address of the purchased tokens
314
+ - `amount`: The amount of tokens to buy (set 0 if using funds-based purchase)
315
+ - `maxFunds`: Max quote to spend when buying a fixed `amount` (0 to skip)
316
+ - `funds`: The quote amount to spend when buying AMAP (set 0 if using `amount`)
317
+ - `minAmount`: Minimum token amount expected.
318
+ - `time`: Reserved (currently ignored). You can pass 0.
319
+ - `signature`: Reserved (currently ignored). You can pass empty bytes.
320
+
321
+
322
+
323
+ ## Events
324
+
325
+ - **`TokenCreate(address creator, address token, uint256 requestId, string name, string symbol, uint256 totalSupply, uint256 launchTime, uint256 launchFee)`**
326
+
327
+ Emitted when a new token is created.
328
+
329
+ - `creator`: Address of the creator of the token
330
+ - `token`: Address of the newly created token
331
+ - `requestId`: Unique request ID for the creation
332
+ - `name`: Name of the token
333
+ - `symbol`: Symbol of the token
334
+ - `totalSupply`: Total supply of the token
335
+ - `launchTime`: Timestamp when the token was launched
336
+ - `launchFee`: Fee paid for launching the token
337
+
338
+ - **`TokenPurchase(address token, address account, uint256 price, uint256 amount, uint256 cost, uint256 fee, uint256 offers, uint256 funds)`**
339
+
340
+ Emitted when a token is purchased.
341
+
342
+ - `token`: Address of the token being purchased
343
+ - `account`: Address of the account making the purchase
344
+ - `price`: Price per token at the time of purchase
345
+ - `amount`: Amount of tokens purchased
346
+ - `cost`: Total cost for the purchase
347
+ - `fee`: Fee paid
348
+ - `offers`: Number of offers available at the time of purchase
349
+ - `funds`: Amount of funds raised at the time of sale
350
+ - **`TokenSale(address token, address account, uint256 price, uint256 amount, uint256 cost, uint256 fee, uint256 offers, uint256 funds)`**
351
+
352
+ Emitted when a token is sold.
353
+
354
+ - `token`: Address of the token being sold
355
+ - `account`: Address of the account making the sale
356
+ - `price`: Price per token at the time of sale
357
+ - `amount`: Amount of tokens sold
358
+ - `cost`: Total cost for the sale
359
+ - `fee`: Fee paid
360
+ - `offers`: Number of offers available at the time of sale
361
+ - `funds`: Amount of funds raised at the time of sale
362
+ - **`TradeStop(address token)`**
363
+
364
+ Emitted when trading for a specific token is stopped.
365
+
366
+ - `token`: Address of the token for which trading is stopped
367
+ - **`LiquidityAdded(address base, uint256 offers, address quote, uint256 funds)`**
368
+
369
+ Emitted when liquidity is added to the token.
370
+
371
+ - `base`: Address of the base token
372
+ - `offers`: Number of offers added
373
+ - `quote`: Address of the quote token which is the token traded by. If quote returns address 0, it means the token is traded by BNB. otherwise traded by BEP20
374
+ - `funds`: Total funds added for liquidity
375
+
376
+ # TokenManagerHelper3 (V3)
377
+
378
+ This smart contract is a wrapper of the TokenManager. It is designed for getting token information and performing pre-calculations easily. Support tokens created by both TokenManager V1 and V2.
379
+
380
+ **Address**
381
+
382
+ - BSC: 0xF251F83e40a78868FcfA3FA4599Dad6494E46034
383
+
384
+ - Arbitrum One: 0x02287dc3CcA964a025DAaB1111135A46C10D3A57
385
+
386
+ - Base: 0x1172FABbAc4Fe05f5a5Cebd8EBBC593A76c42399
387
+
388
+ **ABI File**
389
+
390
+ `TokenManagerHelper3.abi`
391
+
392
+ ## Methods
393
+
394
+ - **`getTokenInfo(address token) returns (uint256 version, address tokenManager, address quote, uint256 lastPrice, uint256 tradingFeeRate, uint256 minTradingFee, uint256 launchTime, uint256 offers, uint256 maxOffers, uint256 funds, uint256 maxFunds, bool liquidityAdded)`**
395
+
396
+ Get information about the token.
397
+
398
+ - `token`: The address of your token
399
+ - Returns:
400
+ - `version`: The TokenManager version. If version returns 1, you should call V1 TokenManager methods for trading. If version returns 2, call V2
401
+ - `tokenManager`: The address of the token manager which manages your token. We recommend using this address to call the TokenManager-related interfaces and parameters, replacing the hardcoded TokenManager addresses
402
+ - `quote`: The address of the quote token of your token. If quote returns address 0, it means the token is traded by BNB. otherwise traded by BEP20
403
+ - `lastPrice`: The last price of your token
404
+ - `tradingFeeRate`: The trading fee rate of your token. The actual usage of the fee rate should be the return value divided by 10,000
405
+ - `minTradingFee`: The amount of minimum trading fee
406
+ - `launchTime`: Launch time of the token
407
+ - `offers`: Amount of tokens that are not sold
408
+ - `maxOffers`: Maximum amount of tokens that could be sold before creating Pancake pair
409
+ - `funds`: Amount of paid BNB or BEP20 raised
410
+ - `maxFunds`: Maximum amount of paid BNB or BEP20 that could be raised
411
+ - `liquidityAdded`: True if the Pancake pair has been created
412
+ - **`tryBuy(address token, uint256 amount, uint256 funds) public view returns (address tokenManager, address quote, uint256 estimatedAmount, uint256 estimatedCost, uint256 estimatedFee, uint256 amountMsgValue, uint256 amountApproval, uint256 amountFunds)`**
413
+ Attempt to buy a token and get estimated results.
414
+
415
+ - `token`: The address of the token to purchase
416
+ - `amount`: The amount of the token the user wants to purchase
417
+ - `funds`: The amount of money the user wants to spend (in the quote currency)
418
+
419
+ **Returns**:
420
+ - `tokenManager`: The address of the TokenManager associated with the token
421
+ - `quote`: The address of the quote currency for the token, where `address(0)` represents ETH or BNB
422
+ - `estimatedAmount`: The estimated amount of tokens that can be bought
423
+ - `estimatedCost`: The estimated cost in the quote currency
424
+ - `estimatedFee`: The estimated fee for the transaction
425
+ - `amountMsgValue`: The value to be set in `msg.value` when calling `TokenManager.buyToken()` or `TokenManager.buyTokenAMAP()`
426
+ - `amountApproval`: The amount of tokens that need to be pre-approved for `TokenManager.buyToken()` or `TokenManager.buyTokenAMAP()`
427
+ - `amountFunds`: The value used for the `funds` parameter when calling `TokenManager.buyTokenAMAP()`
428
+
429
+ **Example**:
430
+
431
+ - If the user wants to buy 10,000 tokens:
432
+ - Call: `tryBuy(token, 10000*1e18, 0)`
433
+
434
+ - If the user wants to spend 10 BNB to purchase tokens:
435
+ - Call: `tryBuy(token, 0, 10*1e18)`
436
+
437
+
438
+ - **`trySell(address token, uint256 amount) returns (address tokenManager, address quote, uint256 funds, uint256 fee)`**
439
+
440
+ Just pre-calculate the result if the user sells a specified amount of tokens if needed.
441
+
442
+ - `token`: The address of token
443
+ - `amount`: The amount of token that the user wants to sell
444
+ - Returns:
445
+ - `tokenManager`: The address of the token manager which manages your token
446
+ - `quote`: The address of the quote token of your token
447
+ - `funds`: The amount of quote token users will receive for selling a token
448
+ - `fee`: The amount of quote token users will pay for trading fee
449
+ - **`calcInitialPrice(uint256 maxRaising, uint256 totalSupply, uint256 offers, uint256 reserves) returns (uint256 priceWei)`**
450
+
451
+ This function calculates the initial price of each token based on the specified parameters such as the amount raised, total supply, tokens available for sale, and reserved tokens.
452
+
453
+
454
+ - `maxRaising`: The maximum amount of BNB to be raised. It represents the maximum BNB amount the project aims to raise through the token issuance.
455
+ - `totalSupply`: The total token supply. It represents the maximum amount of tokens the issuer plans to release.
456
+ - `offers`: The number of tokens available for sale in the initial offering. It represents the amount of tokens available for public sale in the initial stage.
457
+ - `reserves`: The reserved token amount. It represents the number of tokens retained by the issuer, typically for the team or future use.
458
+ - Returns:
459
+ - `priceWei`: The initial token price in Wei.
460
+
461
+
462
+
463
+ - **`buyWithEth(uint256 origin, address token, address to, uint256 funds, uint256 minAmount) payable `**
464
+
465
+ If the user wants to buy tokens using BNB directly.
466
+
467
+ > Note: This method is only applicable for ERC20/ERC20 trading pairs (quote token is not address(0)). It is not supported for BNB trading pairs.
468
+
469
+ - `origin`: Set 0
470
+ - `token`: The address of the token to purchase
471
+ - `to`: The recipient address of the purchased tokens. If set to address(0), tokens will be sent to msg.sender
472
+ - `funds`: The amount of BNB to spend
473
+ - `minAmount`: The minimum amount of tokens to receive if the price changes
474
+
475
+ - **`sellForEth(uint256 origin, address token, uint256 amount, uint256 minFunds, uint256 feeRate, address feeRecipient)`**
476
+
477
+ If the user wants to sell tokens for BNB with a third-party fee recipient.
478
+
479
+ > Note: This method is only applicable for ERC20/ERC20 trading pairs (quote token is not address(0)). It is not supported for BNB trading pairs.
480
+
481
+ > Note: The trading fee will be collected in the quote token (ERC20) instead of BNB.
482
+
483
+ - `origin`: Set 0
484
+ - `token`: The address of the token to sell
485
+ - `amount`: The amount of tokens to sell
486
+ - `minFunds`: The minimum amount of BNB to receive
487
+ - `feeRate`: The fee rate for the transaction. 100 means 1%, 10 means 0.1%. (MAX 5%)
488
+ - `feeRecipient`: The address that will receive the fee (in quote token)
489
+
490
+ - **`sellForEth(uint256 origin, address token, address from, uint256 amount, uint256 minFunds, uint256 feeRate, address feeRecipient)`**
491
+
492
+ If the user wants to sell tokens for BNB through a third-party router, the original sender of the transaction must be the token owner.
493
+
494
+ > Note: This method is only applicable for ERC20/ERC20 trading pairs (quote token is not address(0)). It is not supported for BNB trading pairs.
495
+
496
+ > Note: The trading fee will be collected in the quote token (ERC20) instead of BNB.
497
+
498
+ - `origin`: Set 0
499
+ - `token`: The address of the token to sell
500
+ - `from`: The address of the token owner (tx.origin must equal from)
501
+ - `amount`: The amount of tokens to sell
502
+ - `minFunds`: The minimum amount of BNB to receive
503
+ - `feeRate`: The fee rate for the transaction. 100 means 1%, 10 means 0.1%. (MAX 5%)
504
+ - `feeRecipient`: The address that will receive the fee (in quote token)
505
+
506
+ - **`sellForEth(uint256 origin, address token, address from, address to, uint256 amount, uint256 minFunds)`**
507
+
508
+ If the user wants to sell tokens for BNB and specify a different recipient for the BNB proceeds.
509
+
510
+ > Note: This method is only applicable for ERC20/ERC20 trading pairs (quote token is not address(0)). It is not supported for BNB trading pairs.
511
+
512
+ > Note: The trading fee will be collected in the quote token (ERC20) instead of BNB.
513
+ - `origin`: Set 0
514
+ - `token`: The address of the token to sell
515
+ - `from`: The address of the token owner
516
+ - `to`: The address that will receive the BNB proceeds
517
+ - `amount`: The amount of tokens to sell
518
+ - `minFunds`: The minimum amount of BNB to receive
519
+
520
+ # FAQ
521
+
522
+ ## Error Codes
523
+
524
+ ### buyToken Errors
525
+
526
+ | Error Code | Description |
527
+ |------------|-------------|
528
+ | GW - GWEI | Amount precision is not aligned to GWEI |
529
+ | ZA - Zero Address | The 'to' address should not be set to address(0) |
530
+ | TO - Invalid to | The 'to' address should not be set to PancakePair address |
531
+ | Slippage | The amount spent for purchase exceeds maxFunds |
532
+ | More BNB | Insufficient BNB sent in msg.value for purchase |
533
+ | A | Buy X Mode exclusive token by error method. Please use the X Mode buy method.
534
+
535
+ ### sellToken Errors
536
+
537
+ | Error Code | Description |
538
+ |------------|-------------|
539
+ | GW - GWEI | Amount precision is not aligned to GWEI |
540
+ | FR - FeeRate | Fee rate exceeds 5% |
541
+ | SO - Small Order | Order amount is too small |
542
+ | Slippage | Amount of tokens received from sale is less than minAmount |
543
+
544
+
545
+
546
+
547
+ ## How to Identify X Mode Exclusive Tokens
548
+
549
+ There are two ways to determine whether a token is **exclusive** (X Mode):
550
+
551
+ ### 1. Off-chain
552
+
553
+ Query token info via https://four.meme/meme-api/v1/private/token/get?address=[token address] or https://four.meme/meme-api/v1/private/token/getById?id=[requestId]. `requestId` can be got from the TokenCreate event.
554
+ #### Check the `version` value returned from the token information API. If `version = V8`, the token is an **exclusive token**.
555
+
556
+ ### 2. On-chain
557
+
558
+ Retrieve the value:
559
+
560
+ ```solidity
561
+ template = TokenManager2._tokenInfos[tokenAddress].template;
562
+ ```
563
+
564
+ Then check:
565
+
566
+ ```solidity
567
+ if (template & 0x10000 > 0) {
568
+ // The token is exclusive
569
+ }
570
+ ```
571
+
572
+ If the condition above is true, the token is an **exclusive token**.
573
+
574
+ ---
575
+
576
+ ### Interface Reference
577
+
578
+ ```solidity
579
+ interface ITokenManager2 {
580
+ struct TokenInfo {
581
+ address base;
582
+ address quote;
583
+ uint256 template;
584
+ uint256 totalSupply;
585
+ uint256 maxOffers;
586
+ uint256 maxRaising;
587
+ uint256 launchTime;
588
+ uint256 offers;
589
+ uint256 funds;
590
+ uint256 lastPrice;
591
+ uint256 k;
592
+ uint256 t;
593
+ uint256 status;
594
+ }
595
+ }
596
+ ```
597
+
598
+ ## How to Identify TaxToken
599
+
600
+ A **TaxToken** is a token with creator type 5, which supports advanced tax mechanisms and reward distribution.
601
+
602
+ ### On-chain Method
603
+
604
+ Retrieve the creator type from the token's template:
605
+
606
+ ```solidity
607
+ template = TokenManager2._tokenInfos[tokenAddress].template;
608
+ creatorType = (template >> 10) & 0x3F;
609
+ ```
610
+
611
+ Then check:
612
+
613
+ ```solidity
614
+ if (creatorType == 5) {
615
+ // The token is a TaxToken
616
+ } else {
617
+ // The token is a common Token
618
+ }
619
+ ```
620
+
621
+ If `creatorType == 5`, the token is a **TaxToken**.
622
+
623
+ #### Using Samples
624
+
625
+ - TokenIdentifierSample.sol
626
+ - TokenIdentifierSample.js
627
+
628
+ ### Off-chain Method
629
+
630
+ Query token info via https://four.meme/meme-api/v1/private/token/get?address=[token address] or https://four.meme/meme-api/v1/private/token/getById?id=[requestId]. `requestId` can be got from the TokenCreate event.
631
+
632
+ If the returned `data` contains a `taxInfo` object, the token is a **TaxToken**:
633
+
634
+ ```json
635
+ {
636
+ "taxInfo": {
637
+ "feeRate": 10,
638
+ "recipientRate": 0,
639
+ "burnRate": 0,
640
+ "divideRate": 0,
641
+ "liquidityRate": 100,
642
+ "recipientAddress": "",
643
+ "minSharing": 0,
644
+ "m": 0,
645
+ "e": 0
646
+ }
647
+ }
648
+ ```
649
+
650
+ **taxInfo Parameter Definitions:**
651
+
652
+ | Parameter | Description | Notes |
653
+ |-----------|-------------|-------|
654
+ | feeRate | Trading fee rate | Fixed options: 1, 3, 5, or 10 (representing 1%, 3%, 5%, or 10%) |
655
+ | burnRate | Burn rate | Customizable rate value (e.g., 20 = 20%). Sum of burnRate, divideRate, liquidityRate, and recipientRate must equal 100 |
656
+ | divideRate | Dividend distribution rate | Customizable rate value (e.g., 30 = 30%). Sum of burnRate, divideRate, liquidityRate, and recipientRate must equal 100 |
657
+ | liquidityRate | Liquidity pool rate | Customizable rate value (e.g., 0 = 0%). Sum of burnRate, divideRate, liquidityRate, and recipientRate must equal 100 |
658
+ | recipientRate | Recipient allocation rate | Customizable rate value (e.g., 0 = 0%). Sum of burnRate, divideRate, liquidityRate, and recipientRate must equal 100 |
659
+ | recipientAddress | Recipient address | Address to receive allocated tokens (empty string if not used) |
660
+ | minSharing | Minimum sharing threshold | Minimum token amount required to participate in dividends (in ether). Must satisfy: minSharing = d × 10ⁿ (n ≥ 5, 1 ≤ d ≤ 9). Examples: 100000 (1×10⁵), 200000 (2×10⁵), 500000 (5×10⁵), 1000000 (1×10⁶), 9000000 (9×10⁶) |
661
+
662
+
663
+ ## How to Identify AntiSniperFeeMode Tokens
664
+
665
+ A token with **AntiSniperFeeMode** enabled has dynamic trading fees that change over time to prevent sniper bots. This is indicated by `feeSetting > 0` in the token's `TokenInfoEx1` structure.
666
+
667
+ ### On-chain Method
668
+
669
+ Retrieve the `feeSetting` value from the token's extended information:
670
+
671
+ ```solidity
672
+ TokenInfoEx1 memory tix1 = TokenManager2._tokenInfoEx1s[tokenAddress];
673
+ feeSetting = tix1.feeSetting;
674
+ ```
675
+
676
+ Then check:
677
+
678
+ ```solidity
679
+ if (feeSetting > 0) {
680
+ // The token has AntiSniperFeeMode enabled
681
+ }
682
+ ```
683
+
684
+ If `feeSetting > 0`, the token has **AntiSniperFeeMode** enabled.
685
+
686
+ #### Using Samples
687
+
688
+ - TokenIdentifierSample.sol
689
+ - TokenIdentifierSample.js
690
+
691
+ ### Off-chain Method
692
+
693
+ Query token info via https://four.meme/meme-api/v1/private/token/get?address=[token address] or https://four.meme/meme-api/v1/private/token/getById?id=[requestId]. `requestId` can be got from the TokenCreate event.
694
+
695
+ Check the `feePlan` value in the returned `data`:
696
+
697
+ - If `feePlan == true`, the token has **AntiSniperFeeMode** enabled
698
+ - If `feePlan == false`, the token does not have AntiSniperFeeMode enabled
699
+
700
+ **Example Response:**
701
+
702
+ ```json
703
+ {
704
+ "code": "0",
705
+ "data": {
706
+ "feePlan": true,
707
+ ...
708
+ }
709
+ }
710
+ ```
711
+
712
+ When `feePlan` is `true`, the token uses a dynamic fee system where transaction fees automatically decrease block by block after token creation. For detailed block-by-block fee rate information, refer to the [Product Update](https://four-meme.gitbook.io/four.meme/product-update/6-product-update-25-10-30).
713
+
714
+ ## How to Identify Token Created By Agent Creator
715
+
716
+ Tokens created by AI agents can be identified via both on-chain template bits and off-chain API fields. This flag only marks that the token creator is an Agent wallet and **does not imply any new special trading mode or behavior of the token itself**.
717
+
718
+ ### On-chain Method
719
+
720
+ Retrieve the `template` value from the token's `TokenInfo`:
721
+
722
+ ```solidity
723
+ template = TokenManager2._tokenInfos[tokenAddress].template;
724
+ bool isCreatedByAgent = (template & (1 << 85)) != 0;
725
+ ```
726
+
727
+ If `isCreatedByAgent` is `true`, the token is **created by an AI agent**.
728
+ If `isCreatedByAgent` is `false`, the token is **not created by an AI agent**.
729
+
730
+ ### Off-chain Method
731
+
732
+ Query token info via `https://four.meme/meme-api/v1/private/token/get?address=[token address]` or `https://four.meme/meme-api/v1/private/token/getById?id=[requestId]`. `requestId` can be got from the `TokenCreate` event.
733
+
734
+ Check the `aiCreator` value in the returned `data`:
735
+
736
+ - If `aiCreator == true`, the token is **created by an AI agent**
737
+ - If `aiCreator == false`, the token is **not created by an AI agent**
738
+
739
+ **Example Response:**
740
+
741
+ ```json
742
+ {
743
+ "code": "0",
744
+ "data": {
745
+ "aiCreator": true,
746
+ ...
747
+ }
748
+ }
749
+ ```
750
+
751
+ ## How to Identify Agent Wallets
752
+
753
+ You can determine whether a wallet address is an **Agent wallet** by calling the `AgentIdentifier` contract.
754
+
755
+ ### On-chain Method
756
+
757
+ **Contract Information**
758
+
759
+ - **Address on BSC**: `0x09B44A633de9F9EBF6FB9Bdd5b5629d3DD2cef13`
760
+ - **ABI File**: `AgentIdentifier.abi`
761
+
762
+ **Interface**
763
+
764
+ ```solidity
765
+ interface IAgentIdentifier {
766
+ function isAgent(address wallet) external view returns (bool);
767
+ function nftCount() external view returns (uint256);
768
+ function nftAt(uint256 index) external view returns (address);
769
+ }
770
+ ```
771
+
772
+ **Usage**
773
+
774
+ Call `isAgent(wallet)` on the `AgentIdentifier` contract:
775
+
776
+ ```solidity
777
+ IAgentIdentifier ai = IAgentIdentifier(0x09B44A633de9F9EBF6FB9Bdd5b5629d3DD2cef13);
778
+ bool isAgent = ai.isAgent(wallet);
779
+ ```
780
+
781
+ - Returns `true` if the wallet is an Agent wallet, otherwise `false`.
782
+ - Logic: `isAgent(wallet)` is `true` when the wallet holds any Agent NFT (`balanceOf(wallet) > 0`).
783
+
784
+ You can also query which Agent NFTs are configured:
785
+
786
+ - `nftCount()` returns the number of Agent NFT contracts
787
+ - `nftAt(index)` returns the Agent NFT contract address at `index`
788
+
789
+ Tokens created by wallets where `isAgent == true` will be marked as **Agent Creator** and can be identified as **Token Created By Agent Creator** using the methods described in the previous section.