@kurox_real/plugin-rugshield-402 0.0.0-stage → 1.0.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.
- package/README.md +47 -2
- package/dist/index.d.ts +20 -0
- package/dist/index.js +84 -0
- package/package.json +48 -4
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kurox_real/plugin-rugshield-402 🛡️
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Autonomous Pre-Swap Honeypot Detection & Tax Verification Plugin for ElizaOS Agents on Base**
|
|
4
|
+
|
|
5
|
+
Gated by the **x402 Payment Protocol** ($0.005 USDC per scan on Base Mainnet).
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
This plugin provides the `PRE_SWAP_RISK_CHECK` action for ElizaOS agents. Before an agent swaps any token on Base (Aerodrome, Uniswap v3), it automatically queries the RugShield 402 engine to:
|
|
9
|
+
- Detect buy/sell honeypots and non-transferable token traps
|
|
10
|
+
- Calculate real buy & sell taxes (bps)
|
|
11
|
+
- Verify pool liquidity depth
|
|
12
|
+
- Block swaps if honeypots or high-tax drainers are detected
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
```bash
|
|
16
|
+
npm install @kurox_real/plugin-rugshield-402
|
|
17
|
+
# or
|
|
18
|
+
bun add @kurox_real/plugin-rugshield-402
|
|
19
|
+
# or
|
|
20
|
+
pnpm add @kurox_real/plugin-rugshield-402
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Agent Configuration
|
|
24
|
+
Import and add `rugshieldPlugin` to your ElizaOS agent's character file:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { rugshieldPlugin } from "@kurox_real/plugin-rugshield-402";
|
|
28
|
+
|
|
29
|
+
export const defaultCharacter = {
|
|
30
|
+
name: "DeFiTrader",
|
|
31
|
+
plugins: [rugshieldPlugin],
|
|
32
|
+
// ...
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or in JSON character configuration:
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"name": "DeFiTrader",
|
|
40
|
+
"plugins": ["@kurox_real/plugin-rugshield-402"]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Environment Variables
|
|
45
|
+
- `RUGSHIELD_URL`: (Optional) Custom RugShield 402 host. Defaults to `https://rugshield-402.onrender.com`.
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ElizaAction {
|
|
2
|
+
name: string;
|
|
3
|
+
similes: string[];
|
|
4
|
+
description: string;
|
|
5
|
+
validate: (runtime: any, message: any) => Promise<boolean>;
|
|
6
|
+
handler: (runtime: any, message: any, state?: any, options?: any, callback?: any) => Promise<any>;
|
|
7
|
+
examples: any[][];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* ElizaOS Action: PRE_SWAP_RISK_CHECK
|
|
11
|
+
* Automatically intercepts swap requests and calls RugShield 402 on Base
|
|
12
|
+
* to protect the agent's wallet from honeypots, malicious taxes, and liquidity drains.
|
|
13
|
+
*/
|
|
14
|
+
export declare const preSwapRiskCheckAction: ElizaAction;
|
|
15
|
+
export declare const rugshieldPlugin: {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
actions: ElizaAction[];
|
|
19
|
+
};
|
|
20
|
+
export default rugshieldPlugin;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ElizaOS Action: PRE_SWAP_RISK_CHECK
|
|
3
|
+
* Automatically intercepts swap requests and calls RugShield 402 on Base
|
|
4
|
+
* to protect the agent's wallet from honeypots, malicious taxes, and liquidity drains.
|
|
5
|
+
*/
|
|
6
|
+
export const preSwapRiskCheckAction = {
|
|
7
|
+
name: "PRE_SWAP_RISK_CHECK",
|
|
8
|
+
similes: [
|
|
9
|
+
"CHECK_HONEYPOT",
|
|
10
|
+
"VERIFY_TOKEN_SAFETY",
|
|
11
|
+
"SIMULATE_TOKEN_TAX",
|
|
12
|
+
"AUDIT_BASE_TOKEN",
|
|
13
|
+
"RUGSHIELD_CHECK"
|
|
14
|
+
],
|
|
15
|
+
description: "MANDATORY check before executing DEX swaps on Base. Queries RugShield 402 to detect honeypots, high buy/sell taxes, and drained liquidity. Cost: 0.005 USDC on Base.",
|
|
16
|
+
validate: async (_runtime, message) => {
|
|
17
|
+
const text = message.content?.text || "";
|
|
18
|
+
// Matches 0x addresses on Base
|
|
19
|
+
return /0x[a-fA-F0-9]{40}/i.test(text);
|
|
20
|
+
},
|
|
21
|
+
handler: async (runtime, message, _state, _options, callback) => {
|
|
22
|
+
const text = message.content?.text || "";
|
|
23
|
+
const match = text.match(/0x[a-fA-F0-9]{40}/i);
|
|
24
|
+
if (!match)
|
|
25
|
+
return false;
|
|
26
|
+
const tokenAddress = match[0];
|
|
27
|
+
const endpoint = process.env.RUGSHIELD_URL || "https://rugshield-402.onrender.com";
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(`${endpoint}/v1/scan`, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: { "Content-Type": "application/json" },
|
|
32
|
+
body: JSON.stringify({
|
|
33
|
+
token_address: tokenAddress,
|
|
34
|
+
chain_id: 8453,
|
|
35
|
+
simulate_sell: true
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
if (response.status === 402) {
|
|
39
|
+
const challenge = await response.json();
|
|
40
|
+
if (callback) {
|
|
41
|
+
callback({
|
|
42
|
+
text: `RugShield 402 payment required ($0.005 USDC on Base). PayTo: ${challenge.payTo}`,
|
|
43
|
+
action: "X402_PAYMENT_REQUIRED",
|
|
44
|
+
challenge
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const report = await response.json();
|
|
50
|
+
const isSafe = report.recommendation === "SAFE_TO_SWAP";
|
|
51
|
+
if (callback) {
|
|
52
|
+
callback({
|
|
53
|
+
text: `RugShield Security Report for ${report.symbol} (${tokenAddress}):\n` +
|
|
54
|
+
`• Recommendation: ${report.recommendation}\n` +
|
|
55
|
+
`• Honeypot: ${report.is_honeypot ? "YES (DO NOT BUY)" : "NO"}\n` +
|
|
56
|
+
`• Buy Tax: ${report.buy_tax_bps / 100}%\n` +
|
|
57
|
+
`• Sell Tax: ${report.sell_tax_bps / 100}%\n` +
|
|
58
|
+
`• Pool Liquidity: $${report.liquidity_usd.toLocaleString()}\n` +
|
|
59
|
+
`• Risk Score: ${report.risk_score}`,
|
|
60
|
+
report
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return isSafe;
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
if (callback) {
|
|
67
|
+
callback({ text: `Failed to query RugShield: ${err.message}` });
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
examples: [
|
|
73
|
+
[
|
|
74
|
+
{ user: "{{user1}}", content: { text: "Swap 0.05 ETH for 0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed on Base" } },
|
|
75
|
+
{ user: "{{agent}}", content: { text: "Running pre-swap risk check via RugShield 402...", action: "PRE_SWAP_RISK_CHECK" } }
|
|
76
|
+
]
|
|
77
|
+
]
|
|
78
|
+
};
|
|
79
|
+
export const rugshieldPlugin = {
|
|
80
|
+
name: "plugin-rugshield-402",
|
|
81
|
+
description: "RugShield 402 DEX Honeypot & Tax Protection Plugin for ElizaOS Agents on Base",
|
|
82
|
+
actions: [preSwapRiskCheckAction]
|
|
83
|
+
};
|
|
84
|
+
export default rugshieldPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurox_real/plugin-rugshield-402",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "RugShield 402 DEX honeypot detection, buy/sell tax simulation, and pool liquidity verification action for ElizaOS agents on Base (x402 gated).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"elizaos",
|
|
26
|
+
"eliza",
|
|
27
|
+
"plugin",
|
|
28
|
+
"rugshield",
|
|
29
|
+
"x402",
|
|
30
|
+
"base",
|
|
31
|
+
"usdc",
|
|
32
|
+
"honeypot",
|
|
33
|
+
"defi",
|
|
34
|
+
"security"
|
|
35
|
+
],
|
|
36
|
+
"author": "kurox_real",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/ak10082247-max/rugshield-402.git",
|
|
44
|
+
"directory": "plugins/eliza-rugshield"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"typescript": "^5.7.2"
|
|
49
|
+
}
|
|
50
|
+
}
|