@four-meme/four-meme-ai 1.0.4 → 1.0.6
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/CLAUDE.md +91 -91
- package/README.md +136 -108
- package/bin/fourmeme.cjs +171 -128
- package/package.json +2 -1
- package/skills/four-meme-integration/SKILL.md +18 -25
- package/skills/four-meme-integration/references/agent-creator-and-wallets.md +87 -0
- package/skills/four-meme-integration/references/api-create-token.md +55 -55
- package/skills/four-meme-integration/references/contract-addresses.md +47 -34
- package/skills/four-meme-integration/references/create-token-scripts.md +111 -63
- package/skills/four-meme-integration/references/errors.md +29 -27
- package/skills/four-meme-integration/references/event-listening.md +75 -75
- package/skills/four-meme-integration/references/execute-trade.md +31 -31
- package/skills/four-meme-integration/references/tax-token-query.md +38 -38
- package/skills/four-meme-integration/references/token-tax-info.md +77 -77
- package/skills/four-meme-integration/scripts/8004-balance.ts +52 -52
- package/skills/four-meme-integration/scripts/8004-register.ts +108 -108
- package/skills/four-meme-integration/scripts/create-token-api.ts +321 -251
- package/skills/four-meme-integration/scripts/create-token-chain.ts +102 -85
- package/skills/four-meme-integration/scripts/create-token-instant.ts +106 -0
- package/skills/four-meme-integration/scripts/execute-buy.ts +198 -198
- package/skills/four-meme-integration/scripts/execute-sell.ts +150 -150
- package/skills/four-meme-integration/scripts/send-token.ts +98 -98
package/bin/fourmeme.cjs
CHANGED
|
@@ -1,128 +1,171 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* fourmeme CLI - dispatches to four-meme-integration scripts.
|
|
4
|
-
* Usage: fourmeme <command> [args...]
|
|
5
|
-
* Run "fourmeme --help" for commands.
|
|
6
|
-
* Loads .env from current working directory (where you run fourmeme) if present.
|
|
7
|
-
*/
|
|
8
|
-
const { spawnSync } = require('child_process');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
|
|
11
|
-
// Load .env from cwd (e.g. your project dir) so PRIVATE_KEY, BSC_RPC_URL etc. work when running from a project
|
|
12
|
-
require('dotenv').config({ path: path.join(process.cwd(), '.env') });
|
|
13
|
-
|
|
14
|
-
const root = path.join(__dirname, '..');
|
|
15
|
-
const scriptsDir = path.join(root, 'skills', 'four-meme-integration', 'scripts');
|
|
16
|
-
|
|
17
|
-
const commands = {
|
|
18
|
-
config: 'get-public-config.ts',
|
|
19
|
-
'create-api': 'create-token-api.ts',
|
|
20
|
-
'create-chain': 'create-token-chain.ts',
|
|
21
|
-
'
|
|
22
|
-
'token-
|
|
23
|
-
'token-
|
|
24
|
-
'token-
|
|
25
|
-
'
|
|
26
|
-
'quote-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'8004-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
config
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
create-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* fourmeme CLI - dispatches to four-meme-integration scripts.
|
|
4
|
+
* Usage: fourmeme <command> [args...]
|
|
5
|
+
* Run "fourmeme --help" for commands.
|
|
6
|
+
* Loads .env from current working directory (where you run fourmeme) if present.
|
|
7
|
+
*/
|
|
8
|
+
const { spawnSync } = require('child_process');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
// Load .env from cwd (e.g. your project dir) so PRIVATE_KEY, BSC_RPC_URL etc. work when running from a project
|
|
12
|
+
require('dotenv').config({ path: path.join(process.cwd(), '.env') });
|
|
13
|
+
|
|
14
|
+
const root = path.join(__dirname, '..');
|
|
15
|
+
const scriptsDir = path.join(root, 'skills', 'four-meme-integration', 'scripts');
|
|
16
|
+
|
|
17
|
+
const commands = {
|
|
18
|
+
config: 'get-public-config.ts',
|
|
19
|
+
'create-api': 'create-token-api.ts',
|
|
20
|
+
'create-chain': 'create-token-chain.ts',
|
|
21
|
+
'create-instant': 'create-token-instant.ts',
|
|
22
|
+
'token-info': 'get-token-info.ts',
|
|
23
|
+
'token-list': 'token-list.ts',
|
|
24
|
+
'token-get': 'token-get.ts',
|
|
25
|
+
'token-rankings': 'token-rankings.ts',
|
|
26
|
+
'quote-buy': 'quote-buy.ts',
|
|
27
|
+
'quote-sell': 'quote-sell.ts',
|
|
28
|
+
buy: 'execute-buy.ts',
|
|
29
|
+
sell: 'execute-sell.ts',
|
|
30
|
+
send: 'send-token.ts',
|
|
31
|
+
'8004-register': '8004-register.ts',
|
|
32
|
+
'8004-balance': '8004-balance.ts',
|
|
33
|
+
events: 'get-recent-events.ts',
|
|
34
|
+
'tax-info': 'get-tax-token-info.ts',
|
|
35
|
+
verify: null, // special: run config + verify-events
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function run(scriptName, args = []) {
|
|
39
|
+
const scriptPath = path.join(scriptsDir, scriptName);
|
|
40
|
+
const result = spawnSync('npx', ['tsx', scriptPath, ...args], {
|
|
41
|
+
stdio: 'inherit',
|
|
42
|
+
shell: true,
|
|
43
|
+
cwd: root,
|
|
44
|
+
});
|
|
45
|
+
process.exit(result.status ?? 1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function printHelp() {
|
|
49
|
+
console.log(`fourmeme - Four.meme CLI (BSC only)
|
|
50
|
+
|
|
51
|
+
Usage: npx fourmeme <command> [args...]
|
|
52
|
+
|
|
53
|
+
Commands and parameters:
|
|
54
|
+
|
|
55
|
+
config
|
|
56
|
+
(no args) Get public config (raisedToken). No auth.
|
|
57
|
+
|
|
58
|
+
create-api
|
|
59
|
+
Required: --image=<path> --name=<name> --short-name=<symbol> --desc=<text> --label=<label>
|
|
60
|
+
Optional: --web-url= --twitter-url= --telegram-url= (omit if empty)
|
|
61
|
+
--pre-sale=<BNB> (ether units, e.g. 0.001)
|
|
62
|
+
--fee-plan=false
|
|
63
|
+
--tax-options=<path> OR --tax-token --tax-fee-rate=5 --tax-burn-rate=0
|
|
64
|
+
--tax-divide-rate=0 --tax-liquidity-rate=100 --tax-recipient-rate=0
|
|
65
|
+
--tax-recipient-address= --tax-min-sharing=100000
|
|
66
|
+
Label: Meme|AI|Defi|Games|Infra|De-Sci|Social|Depin|Charity|Others
|
|
67
|
+
Env: PRIVATE_KEY.
|
|
68
|
+
|
|
69
|
+
create-chain
|
|
70
|
+
<createArgHex> <signatureHex> [--value=<wei>]
|
|
71
|
+
Or: fourmeme create-chain -- (read createArg, signature, creationFeeWei from stdin JSON)
|
|
72
|
+
Env: PRIVATE_KEY, optional CREATION_FEE_WEI.
|
|
73
|
+
|
|
74
|
+
create-instant
|
|
75
|
+
Required: --image=<path> --name=<name> --short-name=<symbol> --desc=<text> --label=<label>
|
|
76
|
+
Optional: --web-url= --twitter-url= --telegram-url= (omit if empty)
|
|
77
|
+
--pre-sale=<BNB> (ether units, e.g. 0.001)
|
|
78
|
+
--fee-plan=false
|
|
79
|
+
--value=<wei> (override computed creation fee; default from API)
|
|
80
|
+
--tax-options=<path> OR --tax-token --tax-fee-rate=5 --tax-burn-rate=0
|
|
81
|
+
--tax-divide-rate=0 --tax-liquidity-rate=100 --tax-recipient-rate=0
|
|
82
|
+
--tax-recipient-address= --tax-min-sharing=100000
|
|
83
|
+
Label: Meme|AI|Defi|Games|Infra|De-Sci|Social|Depin|Charity|Others
|
|
84
|
+
One-shot: API + submit createToken. Env: PRIVATE_KEY.
|
|
85
|
+
|
|
86
|
+
token-info <tokenAddress>
|
|
87
|
+
On-chain token info (Helper3). No auth.
|
|
88
|
+
|
|
89
|
+
token-list
|
|
90
|
+
[--orderBy=Hot] [--pageIndex=1] [--pageSize=30] [--tokenName=] [--symbol=] [--labels=] [--listedPancake=false]
|
|
91
|
+
REST token list. No auth.
|
|
92
|
+
|
|
93
|
+
token-get <tokenAddress>
|
|
94
|
+
REST token detail + trading info. No auth.
|
|
95
|
+
|
|
96
|
+
token-rankings <orderBy> [--barType=HOUR24]
|
|
97
|
+
orderBy: Time|ProgressDesc|TradingDesc|Hot|Graduated. barType for TradingDesc. No auth.
|
|
98
|
+
|
|
99
|
+
quote-buy <tokenAddress> <amountWei> [fundsWei]
|
|
100
|
+
Estimate buy. Use 0 for amount or funds. No tx.
|
|
101
|
+
|
|
102
|
+
quote-sell <tokenAddress> <amountWei>
|
|
103
|
+
Estimate sell. No tx.
|
|
104
|
+
|
|
105
|
+
buy <tokenAddress> amount <amountWei> <maxFundsWei>
|
|
106
|
+
Buy fixed token amount. Env: PRIVATE_KEY.
|
|
107
|
+
|
|
108
|
+
buy <tokenAddress> funds <fundsWei> <minAmountWei>
|
|
109
|
+
Spend fixed quote (e.g. BNB). Env: PRIVATE_KEY.
|
|
110
|
+
|
|
111
|
+
sell <tokenAddress> <amountWei> [minFundsWei]
|
|
112
|
+
Execute sell. Env: PRIVATE_KEY.
|
|
113
|
+
|
|
114
|
+
send <toAddress> <amountWei> [tokenAddress]
|
|
115
|
+
Send BNB or ERC20. Omit tokenAddress for BNB. Env: PRIVATE_KEY.
|
|
116
|
+
|
|
117
|
+
8004-register <name> [imageUrl] [description]
|
|
118
|
+
EIP-8004 register identity NFT. Env: PRIVATE_KEY.
|
|
119
|
+
|
|
120
|
+
8004-balance <ownerAddress>
|
|
121
|
+
EIP-8004 query NFT balance. Read-only.
|
|
122
|
+
|
|
123
|
+
events <fromBlock> [toBlock]
|
|
124
|
+
TokenManager2 events (BSC). toBlock default: latest.
|
|
125
|
+
|
|
126
|
+
tax-info <tokenAddress>
|
|
127
|
+
TaxToken fee/tax config (creatorType 5). Read-only.
|
|
128
|
+
|
|
129
|
+
verify
|
|
130
|
+
(no args) Config + events last 50 blocks. Read-only.
|
|
131
|
+
|
|
132
|
+
Env: PRIVATE_KEY (required for create-api, create-chain, create-instant, buy, sell, send, 8004-register).
|
|
133
|
+
BSC_RPC_URL, CREATION_FEE_WEI optional. See SKILL.md.
|
|
134
|
+
`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const argv = process.argv.slice(2);
|
|
138
|
+
const cmd = argv[0];
|
|
139
|
+
|
|
140
|
+
if (!cmd || cmd === '--help' || cmd === '-h' || cmd === 'help') {
|
|
141
|
+
printHelp();
|
|
142
|
+
process.exit(0);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (cmd === 'verify') {
|
|
146
|
+
const r1 = spawnSync('npx', ['tsx', path.join(scriptsDir, 'get-public-config.ts')], {
|
|
147
|
+
stdio: 'inherit',
|
|
148
|
+
shell: true,
|
|
149
|
+
cwd: root,
|
|
150
|
+
});
|
|
151
|
+
if (r1.status !== 0) process.exit(r1.status ?? 1);
|
|
152
|
+
const r2 = spawnSync('npx', ['tsx', path.join(scriptsDir, 'verify-events.ts')], {
|
|
153
|
+
stdio: 'inherit',
|
|
154
|
+
shell: true,
|
|
155
|
+
cwd: root,
|
|
156
|
+
});
|
|
157
|
+
process.exit(r2.status ?? 1);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const script = commands[cmd];
|
|
161
|
+
if (!script) {
|
|
162
|
+
console.error(`Unknown command: ${cmd}`);
|
|
163
|
+
printHelp();
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (cmd === 'events') {
|
|
168
|
+
run(script, ['56', ...argv.slice(1)]);
|
|
169
|
+
} else {
|
|
170
|
+
run(script, argv.slice(1));
|
|
171
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@four-meme/four-meme-ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Four.meme AI skills for creating and trading meme tokens (BSC only)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"openclaw"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
+
"@four-meme/four-meme-ai": "^1.0.5",
|
|
46
47
|
"dotenv": "^16.0.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: four-meme-ai
|
|
3
3
|
description: |
|
|
4
|
-
CLI tool
|
|
4
|
+
CLI tool for creating and trading meme tokens on Four.Meme (BSC), with structured JSON outputs for config, token details, pricing quotes, on-chain events, and TaxToken fee configuration.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
|
|
8
|
-
USE FOR:
|
|
9
|
-
- Creating meme tokens (API + chain) on BSC, including tax-type tokens
|
|
10
|
-
- Getting buy/sell quotes and token info via TokenManagerHelper3 (BSC only)
|
|
11
|
-
- Listening to TokenCreate, TokenPurchase, TokenSale, LiquidityAdded (TokenManager2, BSC)
|
|
12
|
-
- Querying TaxToken fee/tax config on-chain (BSC only)
|
|
13
|
-
- **Discover → detail → quote → execute**: use token-rankings / token-list / events to find tokens → token-get / token-info for details → quote-buy / quote-sell to estimate → buy / sell to execute (see "Agent workflow: buy/sell from rankings or events" below).
|
|
14
|
-
|
|
15
|
-
BSC only (Arbitrum/Base not supported). **Before use, the fourmeme CLI must be installed** (e.g. `npm install -g @four-meme/four-meme-ai@latest`). Create/chain need PRIVATE_KEY. TokenManager V1 not supported.
|
|
16
|
-
**OpenClaw**: Only **PRIVATE_KEY** is declared in registry metadata (`requires.env`) and is injected when this skill is **enabled**; **BSC_RPC_URL** is optional (set in global env or project `.env`). **Two steps required**: (1) Configure private key in the skill’s `apiKey` or `skills.entries["four-meme-ai"].env`; (2) **Enable this skill** so OpenClaw injects PRIVATE_KEY. See "PRIVATE_KEY and BSC_RPC_URL" and "Declared and optional environment variables" below.
|
|
17
8
|
allowed-tools:
|
|
18
9
|
- Bash(fourmeme *)
|
|
19
10
|
- Bash(npx fourmeme *)
|
|
20
11
|
license: MIT
|
|
21
12
|
metadata:
|
|
22
|
-
{"author":"Four.meme AI Skill","version":"1.0.
|
|
13
|
+
{"author":"Four.meme AI Skill","version":"1.0.4","openclaw":{"requires":{"env":["PRIVATE_KEY"]},"primaryEnv":"PRIVATE_KEY","optionalEnv":["BSC_RPC_URL"]}}
|
|
23
14
|
---
|
|
24
15
|
|
|
25
16
|
## [Agent must follow] User agreement and security notice on first use
|
|
@@ -134,7 +125,7 @@ After collecting the above, execute in this order (handled by scripts or CLI):
|
|
|
134
125
|
4. **Create (API)** — GET `/public/config` for raisedToken (do not modify); `POST /private/token/create` with name, shortName, desc, imgUrl, label, raisedToken, etc.; get createArg, signature.
|
|
135
126
|
5. **Create (chain)** — Call `TokenManager2.createToken(createArg, sign)` on BSC to complete on-chain creation.
|
|
136
127
|
|
|
137
|
-
Commands: first `fourmeme create-api
|
|
128
|
+
Commands: first `fourmeme create-api --image= --name= --short-name= --desc= --label= [options]`, then `fourmeme create-chain <createArgHex> <signatureHex>`. Or one-shot: `fourmeme create-instant --image= ...`. Full API and parameters: [references/api-create-token.md](references/api-create-token.md); script flow and examples: [references/create-token-scripts.md](references/create-token-scripts.md); Tax token params: [references/token-tax-info.md](references/token-tax-info.md).
|
|
138
129
|
|
|
139
130
|
## Agent workflow: buy/sell from rankings or events
|
|
140
131
|
|
|
@@ -219,7 +210,7 @@ When the user asks to create a token, the Agent must ask in this order:
|
|
|
219
210
|
|
|
220
211
|
1. **Tax token or not?**
|
|
221
212
|
Ask: “Do you want to create a tax (Tax) token? If not, it will be a normal token.”
|
|
222
|
-
- If **no**: use `fourmeme create-api
|
|
213
|
+
- If **no**: use `fourmeme create-api --image= --name= --short-name= --desc= --label=` (no --tax-options, no --tax-token).
|
|
223
214
|
- If **yes**: continue to step 2.
|
|
224
215
|
|
|
225
216
|
2. **Tax parameters** (only when user chose tax token)
|
|
@@ -230,8 +221,8 @@ When the user asks to create a token, the Agent must ask in this order:
|
|
|
230
221
|
- **minSharing**: Minimum token balance to participate in dividends (in ether units, e.g. 100000, 1000000).
|
|
231
222
|
|
|
232
223
|
Then either:
|
|
233
|
-
- **Option A**: Write `{ "tokenTaxInfo": { ... } }` to a JSON file and call `fourmeme create-api ...
|
|
234
|
-
- **Option B**:
|
|
224
|
+
- **Option A**: Write `{ "tokenTaxInfo": { ... } }` to a JSON file and call `fourmeme create-api --image= ... --tax-options=<path>`.
|
|
225
|
+
- **Option B**: Run `fourmeme create-api --image= ... --tax-token --tax-fee-rate=5 ...` (and other --tax-* as needed).
|
|
235
226
|
|
|
236
227
|
**Step 1 – Config (optional)**
|
|
237
228
|
```bash
|
|
@@ -255,9 +246,9 @@ Requires `PRIVATE_KEY`. Outputs `createArg` and `signature` (hex).
|
|
|
255
246
|
**Optional env vars** (defaults if omitted): `WEB_URL`, `TWITTER_URL`, `TELEGRAM_URL`; `PRE_SALE` (default `"0"`); `FEE_PLAN` (`"true"` = AntiSniperFeeMode, default `"false"`).
|
|
256
247
|
|
|
257
248
|
```bash
|
|
258
|
-
fourmeme create-api
|
|
259
|
-
# Example: fourmeme create-api
|
|
260
|
-
# Tax: fourmeme create-api
|
|
249
|
+
fourmeme create-api --image=<path> --name= --short-name= --desc= --label= [--tax-options=path]
|
|
250
|
+
# Example: fourmeme create-api --image=./logo.png --name=MyToken --short-name=MTK --desc="Description" --label=AI
|
|
251
|
+
# Tax: fourmeme create-api --image=./logo.png --name=TaxToken --short-name=TAX --desc="Tax token" --label=Meme --tax-options=tax.json
|
|
261
252
|
```
|
|
262
253
|
|
|
263
254
|
**Tax token**
|
|
@@ -303,9 +294,9 @@ fourmeme create-chain <createArgHex> <signatureHex>
|
|
|
303
294
|
To **create and submit on-chain in one go**, the Agent should:
|
|
304
295
|
|
|
305
296
|
1. **Run create-api** to get signature data (same as Step 2 above; JSON with `createArg` and `signature`):
|
|
306
|
-
```bash
|
|
307
|
-
fourmeme create-api
|
|
308
|
-
```
|
|
297
|
+
```bash
|
|
298
|
+
fourmeme create-api --image= --name= --short-name= --desc= --label= [--tax-options=path]
|
|
299
|
+
```
|
|
309
300
|
Parse stdout JSON for `createArg` and `signature` (already hex strings).
|
|
310
301
|
|
|
311
302
|
2. **Run create-chain** with those two values:
|
|
@@ -442,7 +433,8 @@ See [references/tax-token-query.md](references/tax-token-query.md).
|
|
|
442
433
|
|
|
443
434
|
## API and config reference
|
|
444
435
|
|
|
445
|
-
- **Token detail (REST)**: `GET /private/token/get?address=<token>`, `GET /private/token/getById?id=<requestId>` (requestId from TokenCreate event). List/rankings: [references/token-query-api.md](references/token-query-api.md).
|
|
436
|
+
- **Token detail (REST)**: `GET /private/token/get?address=<token>`, `GET /private/token/getById?id=<requestId>` (requestId from TokenCreate event). Response may include `data.aiCreator` (token created by Agent). List/rankings: [references/token-query-api.md](references/token-query-api.md).
|
|
437
|
+
- **Agent Creator / Agent wallets**: On-chain — token template bit 85 for “created by agent”; AgentIdentifier contract (`isAgent(wallet)`) on BSC to identify agent wallets. See [references/agent-creator-and-wallets.md](references/agent-creator-and-wallets.md) and [references/contract-addresses.md](references/contract-addresses.md).
|
|
446
438
|
- **raisedToken**: `GET https://four.meme/meme-api/v1/public/config` for current raisedToken; use as-is in create body; do not modify its fields.
|
|
447
439
|
|
|
448
440
|
## References
|
|
@@ -454,8 +446,9 @@ See [references/tax-token-query.md](references/tax-token-query.md).
|
|
|
454
446
|
| [create-token-scripts.md](references/create-token-scripts.md) | Create token script flow and examples |
|
|
455
447
|
| [token-tax-info.md](references/token-tax-info.md) | Tax token tokenTaxInfo parameters and constraints |
|
|
456
448
|
| [token-query-api.md](references/token-query-api.md) | Token list / detail / rankings REST API |
|
|
457
|
-
| [errors.md](references/errors.md) | buy/sell error codes; X Mode / TaxToken / AntiSniperFeeMode |
|
|
449
|
+
| [errors.md](references/errors.md) | buy/sell error codes; X Mode / TaxToken / AntiSniperFeeMode; Agent Creator |
|
|
450
|
+
| [agent-creator-and-wallets.md](references/agent-creator-and-wallets.md) | Token created by Agent Creator; AgentIdentifier contract and Agent wallets |
|
|
458
451
|
| [execute-trade.md](references/execute-trade.md) | Execute buy/sell CLI and contract usage |
|
|
459
452
|
| [event-listening.md](references/event-listening.md) | TokenManager2 event listening (V2) |
|
|
460
453
|
| [tax-token-query.md](references/tax-token-query.md) | TaxToken on-chain fee/tax query (tax-info) |
|
|
461
|
-
| **Official four.meme API and contracts (online)**: [Protocol Integration](https://four-meme.gitbook.io/four.meme/brand/protocol-integration) | API documents, ABIs: TokenManager, TokenManager2, Helper3, TaxToken, etc. |
|
|
454
|
+
| **Official four.meme API and contracts (online)**: [Protocol Integration](https://four-meme.gitbook.io/four.meme/brand/protocol-integration) | API documents, ABIs: TokenManager, TokenManager2, Helper3, TaxToken, AgentIdentifier, etc. |
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Agent Creator & Agent Wallets
|
|
2
|
+
|
|
3
|
+
This document covers how to identify tokens created by an AI agent (Agent Creator) and how to identify agent wallets on-chain.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## How to Identify Token Created By Agent Creator
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
### On-chain method
|
|
12
|
+
|
|
13
|
+
Read the token's `template` from TokenManager2:
|
|
14
|
+
|
|
15
|
+
```solidity
|
|
16
|
+
template = TokenManager2._tokenInfos[tokenAddress].template;
|
|
17
|
+
bool isCreatedByAgent = (template & (1 << 85)) != 0;
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- If `isCreatedByAgent` is `true`, the token was **created by an AI agent**.
|
|
21
|
+
- If `isCreatedByAgent` is `false`, the token was **not** created by an AI agent.
|
|
22
|
+
|
|
23
|
+
### Off-chain method
|
|
24
|
+
|
|
25
|
+
Query token info via:
|
|
26
|
+
|
|
27
|
+
- `GET https://four.meme/meme-api/v1/private/token/get?address=<token address>`
|
|
28
|
+
- `GET https://four.meme/meme-api/v1/private/token/getById?id=<requestId>` (requestId from TokenCreate event)
|
|
29
|
+
|
|
30
|
+
Check the `aiCreator` field in the response `data`:
|
|
31
|
+
|
|
32
|
+
- If `aiCreator === true`, the token was **created by an AI agent**.
|
|
33
|
+
- If `aiCreator === false`, the token was **not** created by an AI agent.
|
|
34
|
+
|
|
35
|
+
**Example response:**
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"code": "0",
|
|
40
|
+
"data": {
|
|
41
|
+
"aiCreator": true,
|
|
42
|
+
...
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## How to Identify Agent Wallets
|
|
50
|
+
|
|
51
|
+
You can determine whether a wallet address is an **Agent wallet** by calling the **AgentIdentifier** contract.
|
|
52
|
+
|
|
53
|
+
### On-chain method
|
|
54
|
+
|
|
55
|
+
**Contract (BSC)**
|
|
56
|
+
|
|
57
|
+
- **Address**: `0x09B44A633de9F9EBF6FB9Bdd5b5629d3DD2cef13`
|
|
58
|
+
- **ABI**: See official Four.meme API / Protocol Integration docs (`AgentIdentifier.abi`).
|
|
59
|
+
|
|
60
|
+
**Interface**
|
|
61
|
+
|
|
62
|
+
```solidity
|
|
63
|
+
interface IAgentIdentifier {
|
|
64
|
+
function isAgent(address wallet) external view returns (bool);
|
|
65
|
+
function nftCount() external view returns (uint256);
|
|
66
|
+
function nftAt(uint256 index) external view returns (address);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Usage**
|
|
71
|
+
|
|
72
|
+
Call `isAgent(wallet)` on the AgentIdentifier contract:
|
|
73
|
+
|
|
74
|
+
```solidity
|
|
75
|
+
IAgentIdentifier ai = IAgentIdentifier(0x09B44A633de9F9EBF6FB9Bdd5b5629d3DD2cef13);
|
|
76
|
+
bool isAgent = ai.isAgent(wallet);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- Returns `true` if the wallet is an Agent wallet, otherwise `false`.
|
|
80
|
+
- Logic: `isAgent(wallet)` is `true` when the wallet holds any Agent NFT (`balanceOf(wallet) > 0`).
|
|
81
|
+
|
|
82
|
+
**Querying configured Agent NFTs**
|
|
83
|
+
|
|
84
|
+
- `nftCount()` — number of Agent NFT contracts registered.
|
|
85
|
+
- `nftAt(index)` — Agent NFT contract address at `index`.
|
|
86
|
+
|
|
87
|
+
Tokens created by wallets with `isAgent == true` are marked as **Agent Creator** and can be identified as **Token Created By Agent Creator** using the methods above.
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
# Four.meme API – Create Token
|
|
2
|
-
|
|
3
|
-
Base URL: `https://four.meme/meme-api/v1`
|
|
4
|
-
|
|
5
|
-
## Endpoints (in order)
|
|
6
|
-
|
|
7
|
-
| Step | Method | Path | Description |
|
|
8
|
-
|------|--------|------|-------------|
|
|
9
|
-
| 1 | POST | `/private/user/nonce/generate` | Get nonce |
|
|
10
|
-
| 2 | POST | `/private/user/login/dex` | Login → access_token |
|
|
11
|
-
| 3 | POST | `/private/token/upload` | Upload image → imgUrl |
|
|
12
|
-
| 4 | POST | `/private/token/create` | Create → createArg, signature |
|
|
13
|
-
|
|
14
|
-
## 1. Nonce
|
|
15
|
-
|
|
16
|
-
- **URL**: `https://four.meme/meme-api/v1/private/user/nonce/generate`
|
|
17
|
-
- **Body**: `{ "accountAddress": "<wallet>", "verifyType": "LOGIN", "networkCode": "BSC" }`
|
|
18
|
-
- **Response**: `{ "code": "0", "data": "<nonce>" }`
|
|
19
|
-
|
|
20
|
-
## 2. Login
|
|
21
|
-
|
|
22
|
-
- **URL**: `https://four.meme/meme-api/v1/private/user/login/dex`
|
|
23
|
-
- **Body**: Include `verifyInfo.signature` = sign(`You are sign in Meme {nonce}`) with wallet, `verifyInfo.address`, `verifyInfo.networkCode` ("BSC"), `verifyInfo.verifyType` ("LOGIN"), plus region, langType, walletName, etc.
|
|
24
|
-
- **Response**: `{ "code": "0", "data": "<access_token>" }`
|
|
25
|
-
|
|
26
|
-
## 3. Upload image
|
|
27
|
-
|
|
28
|
-
- **URL**: `https://four.meme/meme-api/v1/private/token/upload`
|
|
29
|
-
- **Headers**: `meme-web-access: <access_token>`, `Content-Type: multipart/form-data`
|
|
30
|
-
- **Body**: `file` = image (jpeg/png/gif/bmp/webp)
|
|
31
|
-
- **Response**: `{ "code": "0", "data": "<imgUrl>" }`
|
|
32
|
-
|
|
33
|
-
## 4. Create token
|
|
34
|
-
|
|
35
|
-
- **URL**: `https://four.meme/meme-api/v1/private/token/create`
|
|
36
|
-
- **Headers**: `meme-web-access: <access_token>`, `Content-Type: application/json`
|
|
37
|
-
- **Body**: **Required**: **raisedAmount** (raise amount; use 24 or raisedToken.totalBAmount from public config), **raisedToken** (from `GET /public/config`; do not modify). Customizable: name, shortName, desc, imgUrl, launchTime, label, lpTradingFee (0.0025), webUrl, twitterUrl, telegramUrl, preSale, onlyMPC, feePlan, tokenTaxInfo (optional).
|
|
38
|
-
- **Response**: `{ "code": "0", "data": { "createArg": "...", "signature": "..." } }`
|
|
39
|
-
|
|
40
|
-
Then call **TokenManager2.createToken(createArg, sign)** on BSC with these values (as bytes).
|
|
41
|
-
|
|
42
|
-
## Labels
|
|
43
|
-
|
|
44
|
-
Meme, AI, Defi, Games, Infra, De-Sci, Social, Depin, Charity, Others.
|
|
45
|
-
|
|
46
|
-
## tokenTaxInfo (optional; Tax-type token)
|
|
47
|
-
|
|
48
|
-
Omit to create a normal token; include to create a tax-type token.
|
|
49
|
-
|
|
50
|
-
- **feeRate**: Trading fee; must be **1, 3, 5, or 10** (1%/3%/5%/10%).
|
|
51
|
-
- **burnRate**, **divideRate**, **liquidityRate**, **recipientRate**: All percentages; **sum of the four must be 100**.
|
|
52
|
-
- **recipientAddress**: Address that receives the recipient share; use `""` when not used, and **recipientRate = 0**.
|
|
53
|
-
- **minSharing**: Min balance to participate in dividends (ether units); must satisfy **minSharing = d×10ⁿ**, n≥5, 1≤d≤9, e.g. 100000, 1000000.
|
|
54
|
-
|
|
55
|
-
Full field description and examples: [token-tax-info.md](token-tax-info.md).
|
|
1
|
+
# Four.meme API – Create Token
|
|
2
|
+
|
|
3
|
+
Base URL: `https://four.meme/meme-api/v1`
|
|
4
|
+
|
|
5
|
+
## Endpoints (in order)
|
|
6
|
+
|
|
7
|
+
| Step | Method | Path | Description |
|
|
8
|
+
|------|--------|------|-------------|
|
|
9
|
+
| 1 | POST | `/private/user/nonce/generate` | Get nonce |
|
|
10
|
+
| 2 | POST | `/private/user/login/dex` | Login → access_token |
|
|
11
|
+
| 3 | POST | `/private/token/upload` | Upload image → imgUrl |
|
|
12
|
+
| 4 | POST | `/private/token/create` | Create → createArg, signature |
|
|
13
|
+
|
|
14
|
+
## 1. Nonce
|
|
15
|
+
|
|
16
|
+
- **URL**: `https://four.meme/meme-api/v1/private/user/nonce/generate`
|
|
17
|
+
- **Body**: `{ "accountAddress": "<wallet>", "verifyType": "LOGIN", "networkCode": "BSC" }`
|
|
18
|
+
- **Response**: `{ "code": "0", "data": "<nonce>" }`
|
|
19
|
+
|
|
20
|
+
## 2. Login
|
|
21
|
+
|
|
22
|
+
- **URL**: `https://four.meme/meme-api/v1/private/user/login/dex`
|
|
23
|
+
- **Body**: Include `verifyInfo.signature` = sign(`You are sign in Meme {nonce}`) with wallet, `verifyInfo.address`, `verifyInfo.networkCode` ("BSC"), `verifyInfo.verifyType` ("LOGIN"), plus region, langType, walletName, etc.
|
|
24
|
+
- **Response**: `{ "code": "0", "data": "<access_token>" }`
|
|
25
|
+
|
|
26
|
+
## 3. Upload image
|
|
27
|
+
|
|
28
|
+
- **URL**: `https://four.meme/meme-api/v1/private/token/upload`
|
|
29
|
+
- **Headers**: `meme-web-access: <access_token>`, `Content-Type: multipart/form-data`
|
|
30
|
+
- **Body**: `file` = image (jpeg/png/gif/bmp/webp)
|
|
31
|
+
- **Response**: `{ "code": "0", "data": "<imgUrl>" }`
|
|
32
|
+
|
|
33
|
+
## 4. Create token
|
|
34
|
+
|
|
35
|
+
- **URL**: `https://four.meme/meme-api/v1/private/token/create`
|
|
36
|
+
- **Headers**: `meme-web-access: <access_token>`, `Content-Type: application/json`
|
|
37
|
+
- **Body**: **Required**: **raisedAmount** (raise amount; use 24 or raisedToken.totalBAmount from public config), **raisedToken** (from `GET /public/config`; do not modify). Customizable: name, shortName, desc, imgUrl, launchTime, label, lpTradingFee (0.0025), webUrl, twitterUrl, telegramUrl, preSale, onlyMPC, feePlan, tokenTaxInfo (optional).
|
|
38
|
+
- **Response**: `{ "code": "0", "data": { "createArg": "...", "signature": "..." } }`
|
|
39
|
+
|
|
40
|
+
Then call **TokenManager2.createToken(createArg, sign)** on BSC with these values (as bytes).
|
|
41
|
+
|
|
42
|
+
## Labels
|
|
43
|
+
|
|
44
|
+
Meme, AI, Defi, Games, Infra, De-Sci, Social, Depin, Charity, Others.
|
|
45
|
+
|
|
46
|
+
## tokenTaxInfo (optional; Tax-type token)
|
|
47
|
+
|
|
48
|
+
Omit to create a normal token; include to create a tax-type token.
|
|
49
|
+
|
|
50
|
+
- **feeRate**: Trading fee; must be **1, 3, 5, or 10** (1%/3%/5%/10%).
|
|
51
|
+
- **burnRate**, **divideRate**, **liquidityRate**, **recipientRate**: All percentages; **sum of the four must be 100**.
|
|
52
|
+
- **recipientAddress**: Address that receives the recipient share; use `""` when not used, and **recipientRate = 0**.
|
|
53
|
+
- **minSharing**: Min balance to participate in dividends (ether units); must satisfy **minSharing = d×10ⁿ**, n≥5, 1≤d≤9, e.g. 100000, 1000000.
|
|
54
|
+
|
|
55
|
+
Full field description and examples: [token-tax-info.md](token-tax-info.md).
|