@calp-pro/honeypot-not 1.1.53

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.
@@ -0,0 +1,59 @@
1
+ name: Update honeypot.bin & honeypot-not.bin
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ schedule:
8
+ - cron: '0 * * * *'
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ update-data:
16
+
17
+ permissions:
18
+ contents: write
19
+ id-token: write # Required for OIDC
20
+
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - name: Checkout repository
25
+ uses: actions/checkout@v6
26
+
27
+ - name: Setup Node.js
28
+ uses: actions/setup-node@v6
29
+ with:
30
+ node-version: '24'
31
+ registry-url: 'https://registry.npmjs.org'
32
+
33
+ - name: Update npm
34
+ run: npm install -g npm@latest
35
+
36
+ - name: Install dependencies
37
+ run: npm install
38
+
39
+ - name: Run update
40
+ run: npm start
41
+ timeout-minutes: 50
42
+ continue-on-error: true
43
+
44
+ - name: Commit and push changes
45
+ id: commit
46
+ run: |
47
+ git config --global user.name "github-actions[bot]"
48
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
49
+ git add good_pairs.bin good_tokens.bin good_p2tt.bin honeypot.bin honeypot-not.bin
50
+ if ! git diff --cached --quiet; then
51
+ npm version patch --force -m "chore: update *.bin to %s [skip ci]"
52
+ git push --follow-tags
53
+ echo "can_publish=true" >> $GITHUB_OUTPUT
54
+ elif [ "${{ github.event_name }}" != "schedule" ]; then
55
+ echo "can_publish=true" >> $GITHUB_OUTPUT
56
+ else
57
+ echo "No changes"
58
+ fi
59
+
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # <picture><source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/npm/uniswap-v2-loader@5.0.1/logo-dark.svg"><img alt="calp.pro icon" src="https://cdn.jsdelivr.net/npm/uniswap-v2-loader@5.0.1/logo-light.svg" height="32" align="absmiddle"></picture>&nbsp;&nbsp;honeypot-not
2
+
3
+ Filter pairs which don't have honeypot tokens.<br>
4
+ Honeypot validation by [https://honeypot.is/ethereum](https://honeypot.is/ethereum).<br>
5
+ All pairs processed from protocols:
6
+ - **Uniswap V2**
7
+ * `0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f` fabric [contract](https://etherscan.io/address/0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f)
8
+ - **SushiSwap**
9
+ * `0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac` fabric [contract](https://etherscan.io/address/0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac)
10
+ - **PancakeSwap**
11
+ * `0x1097053fd2ea711dad45caccc45eff7548fcb362` fabric [contract](https://etherscan.io/address/0x1097053fd2ea711dad45caccc45eff7548fcb362)
12
+ - **ShibaSwap**
13
+ * `0x115934131916c8b277dd010ee02de363c09d037c` fabric [contract](https://etherscan.io/address/0x115934131916c8b277dd010ee02de363c09d037c)
14
+ - **DefiSwap**
15
+ * `0x9deb29c9a4c7a88a3c0257393b7f3335338d9a9d` fabric [contract](https://etherscan.io/address/0x9deb29c9a4c7a88a3c0257393b7f3335338d9a9d)
16
+ - **EtherVista**
17
+ * `0x9a27cb5ae0b2cee0bb71f9a85c0d60f3920757b4` fabric [contract](https://etherscan.io/address/0x9a27cb5ae0b2cee0bb71f9a85c0d60f3920757b4)
18
+ - **RadioShack**
19
+ * `0x91fae1bc94a9793708fbc66adcb59087c46dee10` fabric [contract](https://etherscan.io/address/0x91fae1bc94a9793708fbc66adcb59087c46dee10)
20
+
21
+ Positive results stored at DEX DB dump files:
22
+ - `good_pairs.bin`
23
+ - `good_tokens.bin`
24
+ - `good_p2tt.bin`
25
+
26
+ File `honeypost.bin` store of honeypot (bad) tokenes addresses.<br>
27
+ File `honeypost-not.bin` store NOT honeypot (good) tokenes addresses.<br>
28
+
29
+ ## Install and run:
30
+ git clone https://github.com/calp-pro/honeypot-not
31
+ cd honeypot-not
32
+ npm install
33
+ npm start
34
+ ```
package/csv2binary.js ADDED
@@ -0,0 +1,32 @@
1
+ const fs = require('fs')
2
+
3
+ if (!fs.existsSync('honeypot.csv')) {
4
+ console.log('No file "honeypot.csv" for convert to binary.')
5
+ process.exit(0)
6
+ }
7
+
8
+ const count = {good: 0, bad: 0}
9
+ const lines = fs.readFileSync('honeypot.csv').toString().trim().split('\n')
10
+
11
+ console.log('Found "honeypot.csv" file with', lines.length, 'tokens.')
12
+ console.log('Converting to:')
13
+ console.log('\t - honeypot.bin (bad)')
14
+ console.log('\t - honeypot-not.bin (good)')
15
+ console.time('convert')
16
+ for (var i = 0; i < lines.length; i++) {
17
+ const [address, honeypot_is] = lines[i].split(',')
18
+ if (honeypot_is == 'true') {
19
+ count.bad++
20
+ fs.appendFileSync('honeypot.bin', Buffer.from(address.slice(2), 'hex'))
21
+ } else {
22
+ count.good++
23
+ fs.appendFileSync('honeypot-not.bin', Buffer.from(address.slice(2), 'hex'))
24
+ }
25
+ }
26
+ console.timeEnd('convert')
27
+
28
+ console.log('good:', count.good, 'bad:', count.bad)
29
+
30
+
31
+
32
+
package/good_p2tt.bin ADDED
Binary file
package/good_pairs.bin ADDED
Binary file
Binary file
Binary file
package/honeypot.bin ADDED
Binary file
package/index.js ADDED
@@ -0,0 +1,12 @@
1
+ const dex_db = require('@calp-pro/dex-db')
2
+ const fn = require('path').join(__dirname, 'good')
3
+
4
+ var db
5
+
6
+ module.exports = () => {
7
+ if (!db) {
8
+ db = dex_db()
9
+ db.load(fn)
10
+ }
11
+ return db
12
+ }
package/is.js ADDED
@@ -0,0 +1,167 @@
1
+ const fs = require('fs')
2
+ const rl = require('readline')
3
+
4
+ const uniswap_v2_dump = require('uniswap-v2-dump')
5
+ const sushiswap_dump = require('sushiswap-dump')
6
+ const pancakeswap_dump = require('pancakeswap-dump')
7
+ const shibaswap_dump = require('shibaswap-dump')
8
+ const defiswap_dump = require('defiswap-dump')
9
+ const ethervista_dump = require('ethervista-dump')
10
+ const radioshack_dump = require('radioshack-dump')
11
+
12
+ const dex_db = require('@calp-pro/dex-db')
13
+
14
+ const db = dex_db()
15
+ if (fs.existsSync('good_pairs.bin')) {
16
+ db.load('good')
17
+ console.log('DEX DB dump "good" found with pairs:', db.get_all_pairs().length)
18
+ }
19
+
20
+ const honeypot = new Map()
21
+
22
+ const token_checked_count = {
23
+ good: 0,
24
+ bad: 0
25
+ }
26
+ if (fs.existsSync('honeypot.bin')) {
27
+ var buf = fs.readFileSync('honeypot.bin')
28
+ for (var i = 0; i < buf.length; i += 20) {
29
+ const address = '0x' + buf.slice(i, i + 20).toString('hex')
30
+ honeypot.set(address, true)
31
+ token_checked_count.bad++
32
+ }
33
+ console.log('Found "honeypot.bin" file with tokens checked:', token_checked_count.bad)
34
+ }
35
+ if (fs.existsSync('honeypot-not.bin')) {
36
+ var buf = fs.readFileSync('honeypot-not.bin')
37
+ for (var i = 0; i < buf.length; i += 20) {
38
+ const address = '0x' + buf.slice(i, i + 20).toString('hex')
39
+ honeypot.set(address, false)
40
+ token_checked_count.good++
41
+ }
42
+ console.log('Found "honeypot-not.bin" file with tokens checked:', token_checked_count.good)
43
+ }
44
+
45
+ Promise.all(
46
+ [
47
+ uniswap_v2_dump,
48
+ sushiswap_dump,
49
+ pancakeswap_dump,
50
+ shibaswap_dump,
51
+ defiswap_dump,
52
+ ethervista_dump,
53
+ radioshack_dump,
54
+ ].map(_ => _.load({workers: 0}))
55
+ )
56
+ .then(pairs => {
57
+ pairs = pairs.flat()
58
+
59
+ const count = {good: 0, bad: 0, cache_hit: 0, requests: 0}
60
+
61
+ const check_request = address => {
62
+ count.requests++
63
+ return fetch('https://api.honeypot.is/v2/IsHoneypot?address=' + address)
64
+ .then(_ => {
65
+ if (_.ok) return _.json().then(_ => {
66
+ if (!_) {
67
+ throw 'Invalid JSON missed honeypotResult'
68
+ } else if (_.simulationSuccess == false) {
69
+ honeypot.set(address, true)
70
+ fs.appendFileSync('honeypot.bin', Buffer.from(address.slice(2), 'hex'))
71
+ throw 'Honeypot!'
72
+ } else if (!_.honeypotResult) {
73
+ throw 'Invalid JSON missed honeypotResult'
74
+ } else if (_.honeypotResult.isHoneypot == true) {
75
+ honeypot.set(address, true)
76
+ fs.appendFileSync('honeypot.bin', Buffer.from(address.slice(2), 'hex'))
77
+ throw 'Honeypot!'
78
+ } else if (_.honeypotResult.isHoneypot == false) {
79
+ honeypot.set(address, false)
80
+ fs.appendFileSync('honeypot-not.bin', Buffer.from(address.slice(2), 'hex'))
81
+ } else {
82
+ throw 'Invalid JSON honeypotResult.isHoneypot'
83
+ }
84
+ })
85
+ throw 'Request failed'
86
+ })
87
+ }
88
+
89
+
90
+ return pairs.reduce(
91
+ (p, pair, i) =>
92
+ p
93
+ .then(() => {
94
+ if (i % 1000 == 0) {
95
+ db.sort()
96
+ db.save('good')
97
+ }
98
+
99
+ rl.clearLine(process.stdout, 0)
100
+ rl.cursorTo(process.stdout, 0)
101
+ process.stdout.write(`${Math.round(10000 * i / pairs.length) / 100}% | good ${count.good} | bad ${count.bad} | cache_hit ${Math.floor(count.cache_hit)} | requests ${count.requests}`)
102
+
103
+ if (db.get_pair_tokens(pair.pair)[0]) {
104
+ count.good++
105
+ count.cache_hit++
106
+ } else {
107
+ const is_honey_t0 = honeypot.get(pair.token0)
108
+
109
+ if (is_honey_t0 == true) {
110
+ count.bad++
111
+ count.cache_hit += 0.5
112
+ } else {
113
+ const is_honey_t1 = honeypot.get(pair.token1)
114
+
115
+ if (is_honey_t1 == true) {
116
+ count.bad++
117
+ count.cache_hit += 0.5
118
+ } else if (is_honey_t1 == false) {
119
+ count.cache_hit += 0.5
120
+ if (is_honey_t0 == false) {
121
+ count.good++
122
+ db.index([pair.pair, pair.token0, pair.token1])
123
+ } else {
124
+ return check_request(pair.token0)
125
+ .then(() => {
126
+ count.good++
127
+ db.index([pair.pair, pair.token0, pair.token1])
128
+ })
129
+ .catch(() => {
130
+ count.bad++
131
+ })
132
+ }
133
+ } else {
134
+ if (is_honey_t0 == false) {
135
+ count.cache_hit += 0.5
136
+ return check_request(pair.token1)
137
+ .then(() => {
138
+ count.good++
139
+ db.index([pair.pair, pair.token0, pair.token1])
140
+ })
141
+ .catch(() => {
142
+ count.bad++
143
+ })
144
+ } else {
145
+ return Promise.all([
146
+ check_request(pair.token0),
147
+ check_request(pair.token1)
148
+ ])
149
+ .then(() => {
150
+ count.good++
151
+ db.index([pair.pair, pair.token0, pair.token1])
152
+ })
153
+ .catch(() => {
154
+ count.bad++
155
+ })
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }),
161
+ Promise.resolve()
162
+ )
163
+ .then(() => {
164
+ db.sort()
165
+ db.save('good')
166
+ })
167
+ })
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@calp-pro/honeypot-not",
3
+ "version": "1.1.53",
4
+ "description": "Filter all protocols by honeypot.is check",
5
+ "keywords": [
6
+ "honeypot.is",
7
+ "DEX"
8
+ ],
9
+ "homepage": "https://github.com/calp-pro/honeypot-is#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/calp-pro/honeypot-is/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/calp-pro/honeypot-is.git"
16
+ },
17
+ "license": "MIT",
18
+ "author": "Vladimir Spirin (spirin.vladimir@gmail.com)",
19
+ "type": "commonjs",
20
+ "main": "index.js",
21
+ "scripts": {
22
+ "start": "node is.js",
23
+ "test": "node --test test.js"
24
+ },
25
+ "dependencies": {
26
+ "@calp-pro/dex-db": "2.1.*",
27
+ "defiswap-dump": "1.0.*",
28
+ "ethervista-dump": "1.0.*",
29
+ "pancakeswap-dump": "1.0.*",
30
+ "radioshack-dump": "1.0.*",
31
+ "shibaswap-dump": "1.0.*",
32
+ "sushiswap-dump": "1.0.*",
33
+ "uniswap-v2-dump": "3.0.*"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ }
38
+ }
package/test.js ADDED
@@ -0,0 +1,20 @@
1
+ const { describe, before, it } = require('node:test')
2
+ const assert = require('node:assert/strict')
3
+ const honeypot_not = require('./index')
4
+
5
+ describe('Honeypot-not', () => {
6
+
7
+ it('Find arbitrage pairs addresses between WBTC/WETH tokens at PancakeSwap and SushiSwap', () => {
8
+ var db = honeypot_not()
9
+ const pairs = db.find_pairs_with_tokens(
10
+ '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'/*WBTC*/,
11
+ '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'/*WETH*/
12
+ )
13
+ assert.equal(pairs[0], '0x4ab6702b3ed3877e9b1f203f90cbef13d663b0e8', 'WBTC/WETH (Pancake) https://etherscan.io/address/0x4ab6702b3ed3877e9b1f203f90cbef13d663b0e8')
14
+ assert.equal(pairs[1], '0xceff51756c56ceffca006cd410b03ffc46dd3a58', 'WBTC/WETH (Sushi) https://etherscan.io/address/0xceff51756c56ceffca006cd410b03ffc46dd3a58')
15
+ })
16
+
17
+ })
18
+
19
+
20
+