├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── src ├── contractUtils.ts ├── dexWallet.ts ├── getTxReceipt.ts ├── index.ts ├── networkUtils.ts ├── networks.ts ├── pancakeswap │ ├── contracts │ │ ├── BEP20.json │ │ ├── PancakeFactory.json │ │ ├── PancakePair.json │ │ └── PancakeRouter.json │ └── interact.ts ├── pumpOrDump.ts └── uniswap │ ├── contracts │ ├── ERC20.json │ ├── SwapRouter.json │ ├── UniswapV3Factory.json │ └── UniswapV3Pool.json │ ├── quote.ts │ └── swap.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log 3 | .DS_Store 4 | .env 5 | .vscode/ 6 | dist/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEX-BOT 2 | 3 | DEX-BOT is an application for trading on decentralized exchanges 4 | 5 | ## Installation 6 | 7 | ```shell 8 | npm install 9 | ``` 10 | 11 | ## Usage 12 | 13 | ### Main process 14 | 15 | ```shell 16 | npm start 17 | ``` 18 | 19 | ### Pump-and-dump tool for PancakeSwap 20 | 21 | This tool buys or sells the entire balance of a specified token in the pair 22 | 23 | ```shell 24 | npm run src/pumpOrDump.ts token2> 25 | ``` 26 | 27 | Command line arguments: 28 | 29 | token1: Reserve token name if configured (eg. WBNB) or token contract address
30 | token2: Shit token's name if configured (eg. DARK) or token contract address
31 | action: 'pump' | 'dump'
32 | - Pump sells all of token1 for token2 33 | - Dump reverses the pump selling all of token2 for token1 34 | 35 | Examples: 36 | 37 | ```shell 38 | npm run src/pumpOrDump.ts WBNB ACH pump 39 | npm run src/pumpOrDump.ts WBNB 0xBc7d6B50616989655AfD682fb42743507003056D dump 40 | npm run src/pumpOrDump.ts 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c 0xBc7d6B50616989655AfD682fb42743507003056D pump 41 | ``` 42 | 43 | ### Getting a transaction receipt 44 | 45 | A tool for getting a transaction receipt 46 | 47 | ```shell 48 | npm run src/getTxReceipt.ts 0xf90efa044b4a5c5a0da0ba1c9dc3c7a5e53962818c6a7a0d496abcab759736fb 49 | ``` -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dex-bot", 3 | "version": "1.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "dex-bot", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "ethers": "^5.7.2" 13 | }, 14 | "devDependencies": { 15 | "ts-node": "^10.9.1", 16 | "typescript": "^4.9.4" 17 | } 18 | }, 19 | "node_modules/@cspotcode/source-map-support": { 20 | "version": "0.8.1", 21 | "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", 22 | "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", 23 | "dev": true, 24 | "dependencies": { 25 | "@jridgewell/trace-mapping": "0.3.9" 26 | }, 27 | "engines": { 28 | "node": ">=12" 29 | } 30 | }, 31 | "node_modules/@ethersproject/abi": { 32 | "version": "5.7.0", 33 | "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", 34 | "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", 35 | "funding": [ 36 | { 37 | "type": "individual", 38 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 39 | }, 40 | { 41 | "type": "individual", 42 | "url": "https://www.buymeacoffee.com/ricmoo" 43 | } 44 | ], 45 | "dependencies": { 46 | "@ethersproject/address": "^5.7.0", 47 | "@ethersproject/bignumber": "^5.7.0", 48 | "@ethersproject/bytes": "^5.7.0", 49 | "@ethersproject/constants": "^5.7.0", 50 | "@ethersproject/hash": "^5.7.0", 51 | "@ethersproject/keccak256": "^5.7.0", 52 | "@ethersproject/logger": "^5.7.0", 53 | "@ethersproject/properties": "^5.7.0", 54 | "@ethersproject/strings": "^5.7.0" 55 | } 56 | }, 57 | "node_modules/@ethersproject/abstract-provider": { 58 | "version": "5.7.0", 59 | "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", 60 | "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", 61 | "funding": [ 62 | { 63 | "type": "individual", 64 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 65 | }, 66 | { 67 | "type": "individual", 68 | "url": "https://www.buymeacoffee.com/ricmoo" 69 | } 70 | ], 71 | "dependencies": { 72 | "@ethersproject/bignumber": "^5.7.0", 73 | "@ethersproject/bytes": "^5.7.0", 74 | "@ethersproject/logger": "^5.7.0", 75 | "@ethersproject/networks": "^5.7.0", 76 | "@ethersproject/properties": "^5.7.0", 77 | "@ethersproject/transactions": "^5.7.0", 78 | "@ethersproject/web": "^5.7.0" 79 | } 80 | }, 81 | "node_modules/@ethersproject/abstract-signer": { 82 | "version": "5.7.0", 83 | "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", 84 | "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", 85 | "funding": [ 86 | { 87 | "type": "individual", 88 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 89 | }, 90 | { 91 | "type": "individual", 92 | "url": "https://www.buymeacoffee.com/ricmoo" 93 | } 94 | ], 95 | "dependencies": { 96 | "@ethersproject/abstract-provider": "^5.7.0", 97 | "@ethersproject/bignumber": "^5.7.0", 98 | "@ethersproject/bytes": "^5.7.0", 99 | "@ethersproject/logger": "^5.7.0", 100 | "@ethersproject/properties": "^5.7.0" 101 | } 102 | }, 103 | "node_modules/@ethersproject/address": { 104 | "version": "5.7.0", 105 | "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", 106 | "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", 107 | "funding": [ 108 | { 109 | "type": "individual", 110 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 111 | }, 112 | { 113 | "type": "individual", 114 | "url": "https://www.buymeacoffee.com/ricmoo" 115 | } 116 | ], 117 | "dependencies": { 118 | "@ethersproject/bignumber": "^5.7.0", 119 | "@ethersproject/bytes": "^5.7.0", 120 | "@ethersproject/keccak256": "^5.7.0", 121 | "@ethersproject/logger": "^5.7.0", 122 | "@ethersproject/rlp": "^5.7.0" 123 | } 124 | }, 125 | "node_modules/@ethersproject/base64": { 126 | "version": "5.7.0", 127 | "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", 128 | "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", 129 | "funding": [ 130 | { 131 | "type": "individual", 132 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 133 | }, 134 | { 135 | "type": "individual", 136 | "url": "https://www.buymeacoffee.com/ricmoo" 137 | } 138 | ], 139 | "dependencies": { 140 | "@ethersproject/bytes": "^5.7.0" 141 | } 142 | }, 143 | "node_modules/@ethersproject/basex": { 144 | "version": "5.7.0", 145 | "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", 146 | "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", 147 | "funding": [ 148 | { 149 | "type": "individual", 150 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 151 | }, 152 | { 153 | "type": "individual", 154 | "url": "https://www.buymeacoffee.com/ricmoo" 155 | } 156 | ], 157 | "dependencies": { 158 | "@ethersproject/bytes": "^5.7.0", 159 | "@ethersproject/properties": "^5.7.0" 160 | } 161 | }, 162 | "node_modules/@ethersproject/bignumber": { 163 | "version": "5.7.0", 164 | "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", 165 | "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", 166 | "funding": [ 167 | { 168 | "type": "individual", 169 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 170 | }, 171 | { 172 | "type": "individual", 173 | "url": "https://www.buymeacoffee.com/ricmoo" 174 | } 175 | ], 176 | "dependencies": { 177 | "@ethersproject/bytes": "^5.7.0", 178 | "@ethersproject/logger": "^5.7.0", 179 | "bn.js": "^5.2.1" 180 | } 181 | }, 182 | "node_modules/@ethersproject/bytes": { 183 | "version": "5.7.0", 184 | "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", 185 | "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", 186 | "funding": [ 187 | { 188 | "type": "individual", 189 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 190 | }, 191 | { 192 | "type": "individual", 193 | "url": "https://www.buymeacoffee.com/ricmoo" 194 | } 195 | ], 196 | "dependencies": { 197 | "@ethersproject/logger": "^5.7.0" 198 | } 199 | }, 200 | "node_modules/@ethersproject/constants": { 201 | "version": "5.7.0", 202 | "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", 203 | "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", 204 | "funding": [ 205 | { 206 | "type": "individual", 207 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 208 | }, 209 | { 210 | "type": "individual", 211 | "url": "https://www.buymeacoffee.com/ricmoo" 212 | } 213 | ], 214 | "dependencies": { 215 | "@ethersproject/bignumber": "^5.7.0" 216 | } 217 | }, 218 | "node_modules/@ethersproject/contracts": { 219 | "version": "5.7.0", 220 | "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", 221 | "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", 222 | "funding": [ 223 | { 224 | "type": "individual", 225 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 226 | }, 227 | { 228 | "type": "individual", 229 | "url": "https://www.buymeacoffee.com/ricmoo" 230 | } 231 | ], 232 | "dependencies": { 233 | "@ethersproject/abi": "^5.7.0", 234 | "@ethersproject/abstract-provider": "^5.7.0", 235 | "@ethersproject/abstract-signer": "^5.7.0", 236 | "@ethersproject/address": "^5.7.0", 237 | "@ethersproject/bignumber": "^5.7.0", 238 | "@ethersproject/bytes": "^5.7.0", 239 | "@ethersproject/constants": "^5.7.0", 240 | "@ethersproject/logger": "^5.7.0", 241 | "@ethersproject/properties": "^5.7.0", 242 | "@ethersproject/transactions": "^5.7.0" 243 | } 244 | }, 245 | "node_modules/@ethersproject/hash": { 246 | "version": "5.7.0", 247 | "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", 248 | "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", 249 | "funding": [ 250 | { 251 | "type": "individual", 252 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 253 | }, 254 | { 255 | "type": "individual", 256 | "url": "https://www.buymeacoffee.com/ricmoo" 257 | } 258 | ], 259 | "dependencies": { 260 | "@ethersproject/abstract-signer": "^5.7.0", 261 | "@ethersproject/address": "^5.7.0", 262 | "@ethersproject/base64": "^5.7.0", 263 | "@ethersproject/bignumber": "^5.7.0", 264 | "@ethersproject/bytes": "^5.7.0", 265 | "@ethersproject/keccak256": "^5.7.0", 266 | "@ethersproject/logger": "^5.7.0", 267 | "@ethersproject/properties": "^5.7.0", 268 | "@ethersproject/strings": "^5.7.0" 269 | } 270 | }, 271 | "node_modules/@ethersproject/hdnode": { 272 | "version": "5.7.0", 273 | "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", 274 | "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", 275 | "funding": [ 276 | { 277 | "type": "individual", 278 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 279 | }, 280 | { 281 | "type": "individual", 282 | "url": "https://www.buymeacoffee.com/ricmoo" 283 | } 284 | ], 285 | "dependencies": { 286 | "@ethersproject/abstract-signer": "^5.7.0", 287 | "@ethersproject/basex": "^5.7.0", 288 | "@ethersproject/bignumber": "^5.7.0", 289 | "@ethersproject/bytes": "^5.7.0", 290 | "@ethersproject/logger": "^5.7.0", 291 | "@ethersproject/pbkdf2": "^5.7.0", 292 | "@ethersproject/properties": "^5.7.0", 293 | "@ethersproject/sha2": "^5.7.0", 294 | "@ethersproject/signing-key": "^5.7.0", 295 | "@ethersproject/strings": "^5.7.0", 296 | "@ethersproject/transactions": "^5.7.0", 297 | "@ethersproject/wordlists": "^5.7.0" 298 | } 299 | }, 300 | "node_modules/@ethersproject/json-wallets": { 301 | "version": "5.7.0", 302 | "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", 303 | "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", 304 | "funding": [ 305 | { 306 | "type": "individual", 307 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 308 | }, 309 | { 310 | "type": "individual", 311 | "url": "https://www.buymeacoffee.com/ricmoo" 312 | } 313 | ], 314 | "dependencies": { 315 | "@ethersproject/abstract-signer": "^5.7.0", 316 | "@ethersproject/address": "^5.7.0", 317 | "@ethersproject/bytes": "^5.7.0", 318 | "@ethersproject/hdnode": "^5.7.0", 319 | "@ethersproject/keccak256": "^5.7.0", 320 | "@ethersproject/logger": "^5.7.0", 321 | "@ethersproject/pbkdf2": "^5.7.0", 322 | "@ethersproject/properties": "^5.7.0", 323 | "@ethersproject/random": "^5.7.0", 324 | "@ethersproject/strings": "^5.7.0", 325 | "@ethersproject/transactions": "^5.7.0", 326 | "aes-js": "3.0.0", 327 | "scrypt-js": "3.0.1" 328 | } 329 | }, 330 | "node_modules/@ethersproject/keccak256": { 331 | "version": "5.7.0", 332 | "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", 333 | "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", 334 | "funding": [ 335 | { 336 | "type": "individual", 337 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 338 | }, 339 | { 340 | "type": "individual", 341 | "url": "https://www.buymeacoffee.com/ricmoo" 342 | } 343 | ], 344 | "dependencies": { 345 | "@ethersproject/bytes": "^5.7.0", 346 | "js-sha3": "0.8.0" 347 | } 348 | }, 349 | "node_modules/@ethersproject/logger": { 350 | "version": "5.7.0", 351 | "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", 352 | "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", 353 | "funding": [ 354 | { 355 | "type": "individual", 356 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 357 | }, 358 | { 359 | "type": "individual", 360 | "url": "https://www.buymeacoffee.com/ricmoo" 361 | } 362 | ] 363 | }, 364 | "node_modules/@ethersproject/networks": { 365 | "version": "5.7.1", 366 | "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", 367 | "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", 368 | "funding": [ 369 | { 370 | "type": "individual", 371 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 372 | }, 373 | { 374 | "type": "individual", 375 | "url": "https://www.buymeacoffee.com/ricmoo" 376 | } 377 | ], 378 | "dependencies": { 379 | "@ethersproject/logger": "^5.7.0" 380 | } 381 | }, 382 | "node_modules/@ethersproject/pbkdf2": { 383 | "version": "5.7.0", 384 | "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", 385 | "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", 386 | "funding": [ 387 | { 388 | "type": "individual", 389 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 390 | }, 391 | { 392 | "type": "individual", 393 | "url": "https://www.buymeacoffee.com/ricmoo" 394 | } 395 | ], 396 | "dependencies": { 397 | "@ethersproject/bytes": "^5.7.0", 398 | "@ethersproject/sha2": "^5.7.0" 399 | } 400 | }, 401 | "node_modules/@ethersproject/properties": { 402 | "version": "5.7.0", 403 | "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", 404 | "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", 405 | "funding": [ 406 | { 407 | "type": "individual", 408 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 409 | }, 410 | { 411 | "type": "individual", 412 | "url": "https://www.buymeacoffee.com/ricmoo" 413 | } 414 | ], 415 | "dependencies": { 416 | "@ethersproject/logger": "^5.7.0" 417 | } 418 | }, 419 | "node_modules/@ethersproject/providers": { 420 | "version": "5.7.2", 421 | "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", 422 | "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", 423 | "funding": [ 424 | { 425 | "type": "individual", 426 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 427 | }, 428 | { 429 | "type": "individual", 430 | "url": "https://www.buymeacoffee.com/ricmoo" 431 | } 432 | ], 433 | "dependencies": { 434 | "@ethersproject/abstract-provider": "^5.7.0", 435 | "@ethersproject/abstract-signer": "^5.7.0", 436 | "@ethersproject/address": "^5.7.0", 437 | "@ethersproject/base64": "^5.7.0", 438 | "@ethersproject/basex": "^5.7.0", 439 | "@ethersproject/bignumber": "^5.7.0", 440 | "@ethersproject/bytes": "^5.7.0", 441 | "@ethersproject/constants": "^5.7.0", 442 | "@ethersproject/hash": "^5.7.0", 443 | "@ethersproject/logger": "^5.7.0", 444 | "@ethersproject/networks": "^5.7.0", 445 | "@ethersproject/properties": "^5.7.0", 446 | "@ethersproject/random": "^5.7.0", 447 | "@ethersproject/rlp": "^5.7.0", 448 | "@ethersproject/sha2": "^5.7.0", 449 | "@ethersproject/strings": "^5.7.0", 450 | "@ethersproject/transactions": "^5.7.0", 451 | "@ethersproject/web": "^5.7.0", 452 | "bech32": "1.1.4", 453 | "ws": "7.4.6" 454 | } 455 | }, 456 | "node_modules/@ethersproject/random": { 457 | "version": "5.7.0", 458 | "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", 459 | "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", 460 | "funding": [ 461 | { 462 | "type": "individual", 463 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 464 | }, 465 | { 466 | "type": "individual", 467 | "url": "https://www.buymeacoffee.com/ricmoo" 468 | } 469 | ], 470 | "dependencies": { 471 | "@ethersproject/bytes": "^5.7.0", 472 | "@ethersproject/logger": "^5.7.0" 473 | } 474 | }, 475 | "node_modules/@ethersproject/rlp": { 476 | "version": "5.7.0", 477 | "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", 478 | "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", 479 | "funding": [ 480 | { 481 | "type": "individual", 482 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 483 | }, 484 | { 485 | "type": "individual", 486 | "url": "https://www.buymeacoffee.com/ricmoo" 487 | } 488 | ], 489 | "dependencies": { 490 | "@ethersproject/bytes": "^5.7.0", 491 | "@ethersproject/logger": "^5.7.0" 492 | } 493 | }, 494 | "node_modules/@ethersproject/sha2": { 495 | "version": "5.7.0", 496 | "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", 497 | "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", 498 | "funding": [ 499 | { 500 | "type": "individual", 501 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 502 | }, 503 | { 504 | "type": "individual", 505 | "url": "https://www.buymeacoffee.com/ricmoo" 506 | } 507 | ], 508 | "dependencies": { 509 | "@ethersproject/bytes": "^5.7.0", 510 | "@ethersproject/logger": "^5.7.0", 511 | "hash.js": "1.1.7" 512 | } 513 | }, 514 | "node_modules/@ethersproject/signing-key": { 515 | "version": "5.7.0", 516 | "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", 517 | "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", 518 | "funding": [ 519 | { 520 | "type": "individual", 521 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 522 | }, 523 | { 524 | "type": "individual", 525 | "url": "https://www.buymeacoffee.com/ricmoo" 526 | } 527 | ], 528 | "dependencies": { 529 | "@ethersproject/bytes": "^5.7.0", 530 | "@ethersproject/logger": "^5.7.0", 531 | "@ethersproject/properties": "^5.7.0", 532 | "bn.js": "^5.2.1", 533 | "elliptic": "6.5.4", 534 | "hash.js": "1.1.7" 535 | } 536 | }, 537 | "node_modules/@ethersproject/solidity": { 538 | "version": "5.7.0", 539 | "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", 540 | "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", 541 | "funding": [ 542 | { 543 | "type": "individual", 544 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 545 | }, 546 | { 547 | "type": "individual", 548 | "url": "https://www.buymeacoffee.com/ricmoo" 549 | } 550 | ], 551 | "dependencies": { 552 | "@ethersproject/bignumber": "^5.7.0", 553 | "@ethersproject/bytes": "^5.7.0", 554 | "@ethersproject/keccak256": "^5.7.0", 555 | "@ethersproject/logger": "^5.7.0", 556 | "@ethersproject/sha2": "^5.7.0", 557 | "@ethersproject/strings": "^5.7.0" 558 | } 559 | }, 560 | "node_modules/@ethersproject/strings": { 561 | "version": "5.7.0", 562 | "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", 563 | "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", 564 | "funding": [ 565 | { 566 | "type": "individual", 567 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 568 | }, 569 | { 570 | "type": "individual", 571 | "url": "https://www.buymeacoffee.com/ricmoo" 572 | } 573 | ], 574 | "dependencies": { 575 | "@ethersproject/bytes": "^5.7.0", 576 | "@ethersproject/constants": "^5.7.0", 577 | "@ethersproject/logger": "^5.7.0" 578 | } 579 | }, 580 | "node_modules/@ethersproject/transactions": { 581 | "version": "5.7.0", 582 | "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", 583 | "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", 584 | "funding": [ 585 | { 586 | "type": "individual", 587 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 588 | }, 589 | { 590 | "type": "individual", 591 | "url": "https://www.buymeacoffee.com/ricmoo" 592 | } 593 | ], 594 | "dependencies": { 595 | "@ethersproject/address": "^5.7.0", 596 | "@ethersproject/bignumber": "^5.7.0", 597 | "@ethersproject/bytes": "^5.7.0", 598 | "@ethersproject/constants": "^5.7.0", 599 | "@ethersproject/keccak256": "^5.7.0", 600 | "@ethersproject/logger": "^5.7.0", 601 | "@ethersproject/properties": "^5.7.0", 602 | "@ethersproject/rlp": "^5.7.0", 603 | "@ethersproject/signing-key": "^5.7.0" 604 | } 605 | }, 606 | "node_modules/@ethersproject/units": { 607 | "version": "5.7.0", 608 | "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", 609 | "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", 610 | "funding": [ 611 | { 612 | "type": "individual", 613 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 614 | }, 615 | { 616 | "type": "individual", 617 | "url": "https://www.buymeacoffee.com/ricmoo" 618 | } 619 | ], 620 | "dependencies": { 621 | "@ethersproject/bignumber": "^5.7.0", 622 | "@ethersproject/constants": "^5.7.0", 623 | "@ethersproject/logger": "^5.7.0" 624 | } 625 | }, 626 | "node_modules/@ethersproject/wallet": { 627 | "version": "5.7.0", 628 | "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", 629 | "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", 630 | "funding": [ 631 | { 632 | "type": "individual", 633 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 634 | }, 635 | { 636 | "type": "individual", 637 | "url": "https://www.buymeacoffee.com/ricmoo" 638 | } 639 | ], 640 | "dependencies": { 641 | "@ethersproject/abstract-provider": "^5.7.0", 642 | "@ethersproject/abstract-signer": "^5.7.0", 643 | "@ethersproject/address": "^5.7.0", 644 | "@ethersproject/bignumber": "^5.7.0", 645 | "@ethersproject/bytes": "^5.7.0", 646 | "@ethersproject/hash": "^5.7.0", 647 | "@ethersproject/hdnode": "^5.7.0", 648 | "@ethersproject/json-wallets": "^5.7.0", 649 | "@ethersproject/keccak256": "^5.7.0", 650 | "@ethersproject/logger": "^5.7.0", 651 | "@ethersproject/properties": "^5.7.0", 652 | "@ethersproject/random": "^5.7.0", 653 | "@ethersproject/signing-key": "^5.7.0", 654 | "@ethersproject/transactions": "^5.7.0", 655 | "@ethersproject/wordlists": "^5.7.0" 656 | } 657 | }, 658 | "node_modules/@ethersproject/web": { 659 | "version": "5.7.1", 660 | "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", 661 | "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", 662 | "funding": [ 663 | { 664 | "type": "individual", 665 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 666 | }, 667 | { 668 | "type": "individual", 669 | "url": "https://www.buymeacoffee.com/ricmoo" 670 | } 671 | ], 672 | "dependencies": { 673 | "@ethersproject/base64": "^5.7.0", 674 | "@ethersproject/bytes": "^5.7.0", 675 | "@ethersproject/logger": "^5.7.0", 676 | "@ethersproject/properties": "^5.7.0", 677 | "@ethersproject/strings": "^5.7.0" 678 | } 679 | }, 680 | "node_modules/@ethersproject/wordlists": { 681 | "version": "5.7.0", 682 | "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", 683 | "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", 684 | "funding": [ 685 | { 686 | "type": "individual", 687 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 688 | }, 689 | { 690 | "type": "individual", 691 | "url": "https://www.buymeacoffee.com/ricmoo" 692 | } 693 | ], 694 | "dependencies": { 695 | "@ethersproject/bytes": "^5.7.0", 696 | "@ethersproject/hash": "^5.7.0", 697 | "@ethersproject/logger": "^5.7.0", 698 | "@ethersproject/properties": "^5.7.0", 699 | "@ethersproject/strings": "^5.7.0" 700 | } 701 | }, 702 | "node_modules/@jridgewell/resolve-uri": { 703 | "version": "3.1.0", 704 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", 705 | "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", 706 | "dev": true, 707 | "engines": { 708 | "node": ">=6.0.0" 709 | } 710 | }, 711 | "node_modules/@jridgewell/sourcemap-codec": { 712 | "version": "1.4.14", 713 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", 714 | "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", 715 | "dev": true 716 | }, 717 | "node_modules/@jridgewell/trace-mapping": { 718 | "version": "0.3.9", 719 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", 720 | "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", 721 | "dev": true, 722 | "dependencies": { 723 | "@jridgewell/resolve-uri": "^3.0.3", 724 | "@jridgewell/sourcemap-codec": "^1.4.10" 725 | } 726 | }, 727 | "node_modules/@tsconfig/node10": { 728 | "version": "1.0.9", 729 | "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", 730 | "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", 731 | "dev": true 732 | }, 733 | "node_modules/@tsconfig/node12": { 734 | "version": "1.0.11", 735 | "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", 736 | "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", 737 | "dev": true 738 | }, 739 | "node_modules/@tsconfig/node14": { 740 | "version": "1.0.3", 741 | "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", 742 | "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", 743 | "dev": true 744 | }, 745 | "node_modules/@tsconfig/node16": { 746 | "version": "1.0.3", 747 | "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", 748 | "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", 749 | "dev": true 750 | }, 751 | "node_modules/@types/node": { 752 | "version": "18.11.18", 753 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", 754 | "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", 755 | "dev": true, 756 | "peer": true 757 | }, 758 | "node_modules/acorn": { 759 | "version": "8.8.1", 760 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", 761 | "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", 762 | "dev": true, 763 | "bin": { 764 | "acorn": "bin/acorn" 765 | }, 766 | "engines": { 767 | "node": ">=0.4.0" 768 | } 769 | }, 770 | "node_modules/acorn-walk": { 771 | "version": "8.2.0", 772 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", 773 | "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", 774 | "dev": true, 775 | "engines": { 776 | "node": ">=0.4.0" 777 | } 778 | }, 779 | "node_modules/aes-js": { 780 | "version": "3.0.0", 781 | "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", 782 | "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" 783 | }, 784 | "node_modules/arg": { 785 | "version": "4.1.3", 786 | "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", 787 | "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", 788 | "dev": true 789 | }, 790 | "node_modules/bech32": { 791 | "version": "1.1.4", 792 | "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", 793 | "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" 794 | }, 795 | "node_modules/bn.js": { 796 | "version": "5.2.1", 797 | "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", 798 | "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" 799 | }, 800 | "node_modules/brorand": { 801 | "version": "1.1.0", 802 | "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", 803 | "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" 804 | }, 805 | "node_modules/create-require": { 806 | "version": "1.1.1", 807 | "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", 808 | "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", 809 | "dev": true 810 | }, 811 | "node_modules/diff": { 812 | "version": "4.0.2", 813 | "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", 814 | "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", 815 | "dev": true, 816 | "engines": { 817 | "node": ">=0.3.1" 818 | } 819 | }, 820 | "node_modules/elliptic": { 821 | "version": "6.5.4", 822 | "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", 823 | "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", 824 | "dependencies": { 825 | "bn.js": "^4.11.9", 826 | "brorand": "^1.1.0", 827 | "hash.js": "^1.0.0", 828 | "hmac-drbg": "^1.0.1", 829 | "inherits": "^2.0.4", 830 | "minimalistic-assert": "^1.0.1", 831 | "minimalistic-crypto-utils": "^1.0.1" 832 | } 833 | }, 834 | "node_modules/elliptic/node_modules/bn.js": { 835 | "version": "4.12.0", 836 | "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", 837 | "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" 838 | }, 839 | "node_modules/ethers": { 840 | "version": "5.7.2", 841 | "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", 842 | "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", 843 | "funding": [ 844 | { 845 | "type": "individual", 846 | "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" 847 | }, 848 | { 849 | "type": "individual", 850 | "url": "https://www.buymeacoffee.com/ricmoo" 851 | } 852 | ], 853 | "dependencies": { 854 | "@ethersproject/abi": "5.7.0", 855 | "@ethersproject/abstract-provider": "5.7.0", 856 | "@ethersproject/abstract-signer": "5.7.0", 857 | "@ethersproject/address": "5.7.0", 858 | "@ethersproject/base64": "5.7.0", 859 | "@ethersproject/basex": "5.7.0", 860 | "@ethersproject/bignumber": "5.7.0", 861 | "@ethersproject/bytes": "5.7.0", 862 | "@ethersproject/constants": "5.7.0", 863 | "@ethersproject/contracts": "5.7.0", 864 | "@ethersproject/hash": "5.7.0", 865 | "@ethersproject/hdnode": "5.7.0", 866 | "@ethersproject/json-wallets": "5.7.0", 867 | "@ethersproject/keccak256": "5.7.0", 868 | "@ethersproject/logger": "5.7.0", 869 | "@ethersproject/networks": "5.7.1", 870 | "@ethersproject/pbkdf2": "5.7.0", 871 | "@ethersproject/properties": "5.7.0", 872 | "@ethersproject/providers": "5.7.2", 873 | "@ethersproject/random": "5.7.0", 874 | "@ethersproject/rlp": "5.7.0", 875 | "@ethersproject/sha2": "5.7.0", 876 | "@ethersproject/signing-key": "5.7.0", 877 | "@ethersproject/solidity": "5.7.0", 878 | "@ethersproject/strings": "5.7.0", 879 | "@ethersproject/transactions": "5.7.0", 880 | "@ethersproject/units": "5.7.0", 881 | "@ethersproject/wallet": "5.7.0", 882 | "@ethersproject/web": "5.7.1", 883 | "@ethersproject/wordlists": "5.7.0" 884 | } 885 | }, 886 | "node_modules/hash.js": { 887 | "version": "1.1.7", 888 | "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", 889 | "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", 890 | "dependencies": { 891 | "inherits": "^2.0.3", 892 | "minimalistic-assert": "^1.0.1" 893 | } 894 | }, 895 | "node_modules/hmac-drbg": { 896 | "version": "1.0.1", 897 | "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", 898 | "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", 899 | "dependencies": { 900 | "hash.js": "^1.0.3", 901 | "minimalistic-assert": "^1.0.0", 902 | "minimalistic-crypto-utils": "^1.0.1" 903 | } 904 | }, 905 | "node_modules/inherits": { 906 | "version": "2.0.4", 907 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 908 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 909 | }, 910 | "node_modules/js-sha3": { 911 | "version": "0.8.0", 912 | "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", 913 | "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" 914 | }, 915 | "node_modules/make-error": { 916 | "version": "1.3.6", 917 | "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", 918 | "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", 919 | "dev": true 920 | }, 921 | "node_modules/minimalistic-assert": { 922 | "version": "1.0.1", 923 | "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", 924 | "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" 925 | }, 926 | "node_modules/minimalistic-crypto-utils": { 927 | "version": "1.0.1", 928 | "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", 929 | "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" 930 | }, 931 | "node_modules/scrypt-js": { 932 | "version": "3.0.1", 933 | "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", 934 | "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" 935 | }, 936 | "node_modules/ts-node": { 937 | "version": "10.9.1", 938 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", 939 | "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", 940 | "dev": true, 941 | "dependencies": { 942 | "@cspotcode/source-map-support": "^0.8.0", 943 | "@tsconfig/node10": "^1.0.7", 944 | "@tsconfig/node12": "^1.0.7", 945 | "@tsconfig/node14": "^1.0.0", 946 | "@tsconfig/node16": "^1.0.2", 947 | "acorn": "^8.4.1", 948 | "acorn-walk": "^8.1.1", 949 | "arg": "^4.1.0", 950 | "create-require": "^1.1.0", 951 | "diff": "^4.0.1", 952 | "make-error": "^1.1.1", 953 | "v8-compile-cache-lib": "^3.0.1", 954 | "yn": "3.1.1" 955 | }, 956 | "bin": { 957 | "ts-node": "dist/bin.js", 958 | "ts-node-cwd": "dist/bin-cwd.js", 959 | "ts-node-esm": "dist/bin-esm.js", 960 | "ts-node-script": "dist/bin-script.js", 961 | "ts-node-transpile-only": "dist/bin-transpile.js", 962 | "ts-script": "dist/bin-script-deprecated.js" 963 | }, 964 | "peerDependencies": { 965 | "@swc/core": ">=1.2.50", 966 | "@swc/wasm": ">=1.2.50", 967 | "@types/node": "*", 968 | "typescript": ">=2.7" 969 | }, 970 | "peerDependenciesMeta": { 971 | "@swc/core": { 972 | "optional": true 973 | }, 974 | "@swc/wasm": { 975 | "optional": true 976 | } 977 | } 978 | }, 979 | "node_modules/typescript": { 980 | "version": "4.9.4", 981 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", 982 | "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", 983 | "dev": true, 984 | "bin": { 985 | "tsc": "bin/tsc", 986 | "tsserver": "bin/tsserver" 987 | }, 988 | "engines": { 989 | "node": ">=4.2.0" 990 | } 991 | }, 992 | "node_modules/v8-compile-cache-lib": { 993 | "version": "3.0.1", 994 | "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", 995 | "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", 996 | "dev": true 997 | }, 998 | "node_modules/ws": { 999 | "version": "7.4.6", 1000 | "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", 1001 | "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", 1002 | "engines": { 1003 | "node": ">=8.3.0" 1004 | }, 1005 | "peerDependencies": { 1006 | "bufferutil": "^4.0.1", 1007 | "utf-8-validate": "^5.0.2" 1008 | }, 1009 | "peerDependenciesMeta": { 1010 | "bufferutil": { 1011 | "optional": true 1012 | }, 1013 | "utf-8-validate": { 1014 | "optional": true 1015 | } 1016 | } 1017 | }, 1018 | "node_modules/yn": { 1019 | "version": "3.1.1", 1020 | "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", 1021 | "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", 1022 | "dev": true, 1023 | "engines": { 1024 | "node": ">=6" 1025 | } 1026 | } 1027 | } 1028 | } 1029 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dex-bot", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "ts-node": "ts-node", 8 | "start": "ts-node src/index.ts" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "ts-node": "^10.9.1", 15 | "typescript": "^4.9.4" 16 | }, 17 | "dependencies": { 18 | "ethers": "^5.7.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/contractUtils.ts: -------------------------------------------------------------------------------- 1 | import { BigNumber, Contract } from 'ethers' 2 | 3 | export async function callContractMethod(contract: Contract, method: string, inputs: any[], gasPrice: BigNumber) { 4 | 5 | console.log(`${method}(${inputs})`) 6 | 7 | let gasLimit = BigNumber.from(500000) 8 | 9 | try { 10 | const gasEstimate: BigNumber = await contract.estimateGas[method](...inputs) 11 | const gasLimit = gasEstimate.mul(2) 12 | console.log('Gas estimate:', gasEstimate.toBigInt()) 13 | console.log(' Gas limit:', gasLimit.toBigInt()) 14 | } catch (error) { 15 | console.log('Default gas limit:', gasLimit.toBigInt()) 16 | } 17 | 18 | 19 | const txResponse = await contract[method](...inputs, { gasPrice, gasLimit }) 20 | console.log('Done! Tx Hash:', txResponse.hash) 21 | return txResponse 22 | 23 | } -------------------------------------------------------------------------------- /src/dexWallet.ts: -------------------------------------------------------------------------------- 1 | import { ethers, BigNumber } from 'ethers' 2 | 3 | export interface DexWallet { 4 | wallet: ethers.Wallet 5 | walletAddress: string 6 | walletBalance: BigNumber, 7 | providerGasPrice: BigNumber 8 | } 9 | 10 | export const initializeWallet = async (network?: string): Promise => { 11 | 12 | const { PRIVATE_KEY } = process.env 13 | 14 | if (!PRIVATE_KEY) { 15 | throw new Error('Private key missing from env variables') 16 | } 17 | 18 | const provider = network ? 19 | // Connect to the user pprovided network 20 | new ethers.providers.JsonRpcProvider(network) : 21 | // Connect to Ethereum mainnet 22 | ethers.getDefaultProvider() 23 | 24 | // Sign the transaction with the contract owner's private key 25 | const wallet = new ethers.Wallet(PRIVATE_KEY, provider); 26 | 27 | const walletAddress = await wallet.getAddress() 28 | const walletBalance = await wallet.getBalance() 29 | 30 | const providerGasPrice = await provider.getGasPrice() 31 | 32 | return { 33 | wallet, 34 | walletAddress, 35 | walletBalance, 36 | providerGasPrice 37 | } 38 | 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/getTxReceipt.ts: -------------------------------------------------------------------------------- 1 | import { initializeWallet } from './dexWallet' 2 | import { promisify } from 'util' 3 | import { POLYGON } from './networks' 4 | 5 | const txHash = process.argv[2] 6 | 7 | const main = promisify(async () => { 8 | const dexWallet = await initializeWallet(POLYGON[0]) 9 | const { wallet } = dexWallet 10 | const txReceipt = await wallet.provider.getTransactionReceipt(txHash) 11 | console.log('TX RECEIPT', txReceipt) 12 | }) 13 | 14 | main().then(() => { 15 | console.log('Async operation completed') 16 | }) 17 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { swap } from './uniswap/swap' 2 | import { promisify } from 'util' 3 | import { initializeWallet } from './dexWallet' 4 | import { POLYGON } from './networks' 5 | 6 | const main = promisify(async () => { 7 | const dexWallet = await initializeWallet(POLYGON[0]) 8 | await swap( 9 | dexWallet, 10 | [ 11 | '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', // USDC 12 | '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619' // WETH 13 | ] 14 | ,true 15 | ) 16 | }); 17 | 18 | main().then(() => { 19 | console.log('Async operation completed') 20 | }); 21 | 22 | -------------------------------------------------------------------------------- /src/networkUtils.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers' 2 | 3 | export async function waitForTx(provider: ethers.providers.Provider, hash: string): Promise { 4 | 5 | let txReceipt: ethers.providers.TransactionReceipt | null = null 6 | let count = 0 7 | 8 | while(!txReceipt && count < 10) { 9 | txReceipt = await provider.getTransactionReceipt(hash) 10 | await new Promise(resolve => setTimeout(resolve, 1000)); 11 | count++ 12 | } 13 | 14 | if (txReceipt) { 15 | console.log(`TX ${hash} broadcasted`) 16 | return true 17 | } 18 | 19 | return false 20 | 21 | } -------------------------------------------------------------------------------- /src/networks.ts: -------------------------------------------------------------------------------- 1 | export const POLYGON = [ 2 | 'https://polygon-rpc.com/', 3 | 'https://rpc-mainnet.matic.quiknode.pro/' 4 | ] -------------------------------------------------------------------------------- /src/pancakeswap/contracts/BEP20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [], 5 | "name": "name", 6 | "outputs": [ 7 | { 8 | "name": "", 9 | "type": "string" 10 | } 11 | ], 12 | "payable": false, 13 | "stateMutability": "view", 14 | "type": "function" 15 | }, 16 | { 17 | "constant": false, 18 | "inputs": [ 19 | { 20 | "name": "guy", 21 | "type": "address" 22 | }, 23 | { 24 | "name": "wad", 25 | "type": "uint256" 26 | } 27 | ], 28 | "name": "approve", 29 | "outputs": [ 30 | { 31 | "name": "", 32 | "type": "bool" 33 | } 34 | ], 35 | "payable": false, 36 | "stateMutability": "nonpayable", 37 | "type": "function" 38 | }, 39 | { 40 | "constant": true, 41 | "inputs": [], 42 | "name": "totalSupply", 43 | "outputs": [ 44 | { 45 | "name": "", 46 | "type": "uint256" 47 | } 48 | ], 49 | "payable": false, 50 | "stateMutability": "view", 51 | "type": "function" 52 | }, 53 | { 54 | "constant": false, 55 | "inputs": [ 56 | { 57 | "name": "src", 58 | "type": "address" 59 | }, 60 | { 61 | "name": "dst", 62 | "type": "address" 63 | }, 64 | { 65 | "name": "wad", 66 | "type": "uint256" 67 | } 68 | ], 69 | "name": "transferFrom", 70 | "outputs": [ 71 | { 72 | "name": "", 73 | "type": "bool" 74 | } 75 | ], 76 | "payable": false, 77 | "stateMutability": "nonpayable", 78 | "type": "function" 79 | }, 80 | { 81 | "constant": false, 82 | "inputs": [ 83 | { 84 | "name": "wad", 85 | "type": "uint256" 86 | } 87 | ], 88 | "name": "withdraw", 89 | "outputs": [], 90 | "payable": false, 91 | "stateMutability": "nonpayable", 92 | "type": "function" 93 | }, 94 | { 95 | "constant": true, 96 | "inputs": [], 97 | "name": "decimals", 98 | "outputs": [ 99 | { 100 | "name": "", 101 | "type": "uint8" 102 | } 103 | ], 104 | "payable": false, 105 | "stateMutability": "view", 106 | "type": "function" 107 | }, 108 | { 109 | "constant": true, 110 | "inputs": [ 111 | { 112 | "name": "", 113 | "type": "address" 114 | } 115 | ], 116 | "name": "balanceOf", 117 | "outputs": [ 118 | { 119 | "name": "", 120 | "type": "uint256" 121 | } 122 | ], 123 | "payable": false, 124 | "stateMutability": "view", 125 | "type": "function" 126 | }, 127 | { 128 | "constant": true, 129 | "inputs": [], 130 | "name": "symbol", 131 | "outputs": [ 132 | { 133 | "name": "", 134 | "type": "string" 135 | } 136 | ], 137 | "payable": false, 138 | "stateMutability": "view", 139 | "type": "function" 140 | }, 141 | { 142 | "constant": false, 143 | "inputs": [ 144 | { 145 | "name": "dst", 146 | "type": "address" 147 | }, 148 | { 149 | "name": "wad", 150 | "type": "uint256" 151 | } 152 | ], 153 | "name": "transfer", 154 | "outputs": [ 155 | { 156 | "name": "", 157 | "type": "bool" 158 | } 159 | ], 160 | "payable": false, 161 | "stateMutability": "nonpayable", 162 | "type": "function" 163 | }, 164 | { 165 | "constant": false, 166 | "inputs": [], 167 | "name": "deposit", 168 | "outputs": [], 169 | "payable": true, 170 | "stateMutability": "payable", 171 | "type": "function" 172 | }, 173 | { 174 | "constant": true, 175 | "inputs": [ 176 | { 177 | "name": "", 178 | "type": "address" 179 | }, 180 | { 181 | "name": "", 182 | "type": "address" 183 | } 184 | ], 185 | "name": "allowance", 186 | "outputs": [ 187 | { 188 | "name": "", 189 | "type": "uint256" 190 | } 191 | ], 192 | "payable": false, 193 | "stateMutability": "view", 194 | "type": "function" 195 | }, 196 | { 197 | "payable": true, 198 | "stateMutability": "payable", 199 | "type": "fallback" 200 | }, 201 | { 202 | "anonymous": false, 203 | "inputs": [ 204 | { 205 | "indexed": true, 206 | "name": "src", 207 | "type": "address" 208 | }, 209 | { 210 | "indexed": true, 211 | "name": "guy", 212 | "type": "address" 213 | }, 214 | { 215 | "indexed": false, 216 | "name": "wad", 217 | "type": "uint256" 218 | } 219 | ], 220 | "name": "Approval", 221 | "type": "event" 222 | }, 223 | { 224 | "anonymous": false, 225 | "inputs": [ 226 | { 227 | "indexed": true, 228 | "name": "src", 229 | "type": "address" 230 | }, 231 | { 232 | "indexed": true, 233 | "name": "dst", 234 | "type": "address" 235 | }, 236 | { 237 | "indexed": false, 238 | "name": "wad", 239 | "type": "uint256" 240 | } 241 | ], 242 | "name": "Transfer", 243 | "type": "event" 244 | }, 245 | { 246 | "anonymous": false, 247 | "inputs": [ 248 | { 249 | "indexed": true, 250 | "name": "dst", 251 | "type": "address" 252 | }, 253 | { 254 | "indexed": false, 255 | "name": "wad", 256 | "type": "uint256" 257 | } 258 | ], 259 | "name": "Deposit", 260 | "type": "event" 261 | }, 262 | { 263 | "anonymous": false, 264 | "inputs": [ 265 | { 266 | "indexed": true, 267 | "name": "src", 268 | "type": "address" 269 | }, 270 | { 271 | "indexed": false, 272 | "name": "wad", 273 | "type": "uint256" 274 | } 275 | ], 276 | "name": "Withdrawal", 277 | "type": "event" 278 | } 279 | ] -------------------------------------------------------------------------------- /src/pancakeswap/contracts/PancakeFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_feeToSetter", 7 | "type": "address" 8 | } 9 | ], 10 | "payable": false, 11 | "stateMutability": "nonpayable", 12 | "type": "constructor" 13 | }, 14 | { 15 | "anonymous": false, 16 | "inputs": [ 17 | { 18 | "indexed": true, 19 | "internalType": "address", 20 | "name": "token0", 21 | "type": "address" 22 | }, 23 | { 24 | "indexed": true, 25 | "internalType": "address", 26 | "name": "token1", 27 | "type": "address" 28 | }, 29 | { 30 | "indexed": false, 31 | "internalType": "address", 32 | "name": "pair", 33 | "type": "address" 34 | }, 35 | { 36 | "indexed": false, 37 | "internalType": "uint256", 38 | "name": "", 39 | "type": "uint256" 40 | } 41 | ], 42 | "name": "PairCreated", 43 | "type": "event" 44 | }, 45 | { 46 | "constant": true, 47 | "inputs": [], 48 | "name": "INIT_CODE_PAIR_HASH", 49 | "outputs": [ 50 | { 51 | "internalType": "bytes32", 52 | "name": "", 53 | "type": "bytes32" 54 | } 55 | ], 56 | "payable": false, 57 | "stateMutability": "view", 58 | "type": "function" 59 | }, 60 | { 61 | "constant": true, 62 | "inputs": [ 63 | { 64 | "internalType": "uint256", 65 | "name": "", 66 | "type": "uint256" 67 | } 68 | ], 69 | "name": "allPairs", 70 | "outputs": [ 71 | { 72 | "internalType": "address", 73 | "name": "", 74 | "type": "address" 75 | } 76 | ], 77 | "payable": false, 78 | "stateMutability": "view", 79 | "type": "function" 80 | }, 81 | { 82 | "constant": true, 83 | "inputs": [], 84 | "name": "allPairsLength", 85 | "outputs": [ 86 | { 87 | "internalType": "uint256", 88 | "name": "", 89 | "type": "uint256" 90 | } 91 | ], 92 | "payable": false, 93 | "stateMutability": "view", 94 | "type": "function" 95 | }, 96 | { 97 | "constant": false, 98 | "inputs": [ 99 | { 100 | "internalType": "address", 101 | "name": "tokenA", 102 | "type": "address" 103 | }, 104 | { 105 | "internalType": "address", 106 | "name": "tokenB", 107 | "type": "address" 108 | } 109 | ], 110 | "name": "createPair", 111 | "outputs": [ 112 | { 113 | "internalType": "address", 114 | "name": "pair", 115 | "type": "address" 116 | } 117 | ], 118 | "payable": false, 119 | "stateMutability": "nonpayable", 120 | "type": "function" 121 | }, 122 | { 123 | "constant": true, 124 | "inputs": [], 125 | "name": "feeTo", 126 | "outputs": [ 127 | { 128 | "internalType": "address", 129 | "name": "", 130 | "type": "address" 131 | } 132 | ], 133 | "payable": false, 134 | "stateMutability": "view", 135 | "type": "function" 136 | }, 137 | { 138 | "constant": true, 139 | "inputs": [], 140 | "name": "feeToSetter", 141 | "outputs": [ 142 | { 143 | "internalType": "address", 144 | "name": "", 145 | "type": "address" 146 | } 147 | ], 148 | "payable": false, 149 | "stateMutability": "view", 150 | "type": "function" 151 | }, 152 | { 153 | "constant": true, 154 | "inputs": [ 155 | { 156 | "internalType": "address", 157 | "name": "", 158 | "type": "address" 159 | }, 160 | { 161 | "internalType": "address", 162 | "name": "", 163 | "type": "address" 164 | } 165 | ], 166 | "name": "getPair", 167 | "outputs": [ 168 | { 169 | "internalType": "address", 170 | "name": "", 171 | "type": "address" 172 | } 173 | ], 174 | "payable": false, 175 | "stateMutability": "view", 176 | "type": "function" 177 | }, 178 | { 179 | "constant": false, 180 | "inputs": [ 181 | { 182 | "internalType": "address", 183 | "name": "_feeTo", 184 | "type": "address" 185 | } 186 | ], 187 | "name": "setFeeTo", 188 | "outputs": [], 189 | "payable": false, 190 | "stateMutability": "nonpayable", 191 | "type": "function" 192 | }, 193 | { 194 | "constant": false, 195 | "inputs": [ 196 | { 197 | "internalType": "address", 198 | "name": "_feeToSetter", 199 | "type": "address" 200 | } 201 | ], 202 | "name": "setFeeToSetter", 203 | "outputs": [], 204 | "payable": false, 205 | "stateMutability": "nonpayable", 206 | "type": "function" 207 | } 208 | ] -------------------------------------------------------------------------------- /src/pancakeswap/contracts/PancakePair.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "payable": false, 5 | "stateMutability": "nonpayable", 6 | "type": "constructor" 7 | }, 8 | { 9 | "anonymous": false, 10 | "inputs": [ 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "owner", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": true, 19 | "internalType": "address", 20 | "name": "spender", 21 | "type": "address" 22 | }, 23 | { 24 | "indexed": false, 25 | "internalType": "uint256", 26 | "name": "value", 27 | "type": "uint256" 28 | } 29 | ], 30 | "name": "Approval", 31 | "type": "event" 32 | }, 33 | { 34 | "anonymous": false, 35 | "inputs": [ 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "sender", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "amount0", 46 | "type": "uint256" 47 | }, 48 | { 49 | "indexed": false, 50 | "internalType": "uint256", 51 | "name": "amount1", 52 | "type": "uint256" 53 | }, 54 | { 55 | "indexed": true, 56 | "internalType": "address", 57 | "name": "to", 58 | "type": "address" 59 | } 60 | ], 61 | "name": "Burn", 62 | "type": "event" 63 | }, 64 | { 65 | "anonymous": false, 66 | "inputs": [ 67 | { 68 | "indexed": true, 69 | "internalType": "address", 70 | "name": "sender", 71 | "type": "address" 72 | }, 73 | { 74 | "indexed": false, 75 | "internalType": "uint256", 76 | "name": "amount0", 77 | "type": "uint256" 78 | }, 79 | { 80 | "indexed": false, 81 | "internalType": "uint256", 82 | "name": "amount1", 83 | "type": "uint256" 84 | } 85 | ], 86 | "name": "Mint", 87 | "type": "event" 88 | }, 89 | { 90 | "anonymous": false, 91 | "inputs": [ 92 | { 93 | "indexed": true, 94 | "internalType": "address", 95 | "name": "sender", 96 | "type": "address" 97 | }, 98 | { 99 | "indexed": false, 100 | "internalType": "uint256", 101 | "name": "amount0In", 102 | "type": "uint256" 103 | }, 104 | { 105 | "indexed": false, 106 | "internalType": "uint256", 107 | "name": "amount1In", 108 | "type": "uint256" 109 | }, 110 | { 111 | "indexed": false, 112 | "internalType": "uint256", 113 | "name": "amount0Out", 114 | "type": "uint256" 115 | }, 116 | { 117 | "indexed": false, 118 | "internalType": "uint256", 119 | "name": "amount1Out", 120 | "type": "uint256" 121 | }, 122 | { 123 | "indexed": true, 124 | "internalType": "address", 125 | "name": "to", 126 | "type": "address" 127 | } 128 | ], 129 | "name": "Swap", 130 | "type": "event" 131 | }, 132 | { 133 | "anonymous": false, 134 | "inputs": [ 135 | { 136 | "indexed": false, 137 | "internalType": "uint112", 138 | "name": "reserve0", 139 | "type": "uint112" 140 | }, 141 | { 142 | "indexed": false, 143 | "internalType": "uint112", 144 | "name": "reserve1", 145 | "type": "uint112" 146 | } 147 | ], 148 | "name": "Sync", 149 | "type": "event" 150 | }, 151 | { 152 | "anonymous": false, 153 | "inputs": [ 154 | { 155 | "indexed": true, 156 | "internalType": "address", 157 | "name": "from", 158 | "type": "address" 159 | }, 160 | { 161 | "indexed": true, 162 | "internalType": "address", 163 | "name": "to", 164 | "type": "address" 165 | }, 166 | { 167 | "indexed": false, 168 | "internalType": "uint256", 169 | "name": "value", 170 | "type": "uint256" 171 | } 172 | ], 173 | "name": "Transfer", 174 | "type": "event" 175 | }, 176 | { 177 | "constant": true, 178 | "inputs": [], 179 | "name": "DOMAIN_SEPARATOR", 180 | "outputs": [ 181 | { 182 | "internalType": "bytes32", 183 | "name": "", 184 | "type": "bytes32" 185 | } 186 | ], 187 | "payable": false, 188 | "stateMutability": "view", 189 | "type": "function" 190 | }, 191 | { 192 | "constant": true, 193 | "inputs": [], 194 | "name": "MINIMUM_LIQUIDITY", 195 | "outputs": [ 196 | { 197 | "internalType": "uint256", 198 | "name": "", 199 | "type": "uint256" 200 | } 201 | ], 202 | "payable": false, 203 | "stateMutability": "view", 204 | "type": "function" 205 | }, 206 | { 207 | "constant": true, 208 | "inputs": [], 209 | "name": "PERMIT_TYPEHASH", 210 | "outputs": [ 211 | { 212 | "internalType": "bytes32", 213 | "name": "", 214 | "type": "bytes32" 215 | } 216 | ], 217 | "payable": false, 218 | "stateMutability": "view", 219 | "type": "function" 220 | }, 221 | { 222 | "constant": true, 223 | "inputs": [ 224 | { 225 | "internalType": "address", 226 | "name": "", 227 | "type": "address" 228 | }, 229 | { 230 | "internalType": "address", 231 | "name": "", 232 | "type": "address" 233 | } 234 | ], 235 | "name": "allowance", 236 | "outputs": [ 237 | { 238 | "internalType": "uint256", 239 | "name": "", 240 | "type": "uint256" 241 | } 242 | ], 243 | "payable": false, 244 | "stateMutability": "view", 245 | "type": "function" 246 | }, 247 | { 248 | "constant": false, 249 | "inputs": [ 250 | { 251 | "internalType": "address", 252 | "name": "spender", 253 | "type": "address" 254 | }, 255 | { 256 | "internalType": "uint256", 257 | "name": "value", 258 | "type": "uint256" 259 | } 260 | ], 261 | "name": "approve", 262 | "outputs": [ 263 | { 264 | "internalType": "bool", 265 | "name": "", 266 | "type": "bool" 267 | } 268 | ], 269 | "payable": false, 270 | "stateMutability": "nonpayable", 271 | "type": "function" 272 | }, 273 | { 274 | "constant": true, 275 | "inputs": [ 276 | { 277 | "internalType": "address", 278 | "name": "", 279 | "type": "address" 280 | } 281 | ], 282 | "name": "balanceOf", 283 | "outputs": [ 284 | { 285 | "internalType": "uint256", 286 | "name": "", 287 | "type": "uint256" 288 | } 289 | ], 290 | "payable": false, 291 | "stateMutability": "view", 292 | "type": "function" 293 | }, 294 | { 295 | "constant": false, 296 | "inputs": [ 297 | { 298 | "internalType": "address", 299 | "name": "to", 300 | "type": "address" 301 | } 302 | ], 303 | "name": "burn", 304 | "outputs": [ 305 | { 306 | "internalType": "uint256", 307 | "name": "amount0", 308 | "type": "uint256" 309 | }, 310 | { 311 | "internalType": "uint256", 312 | "name": "amount1", 313 | "type": "uint256" 314 | } 315 | ], 316 | "payable": false, 317 | "stateMutability": "nonpayable", 318 | "type": "function" 319 | }, 320 | { 321 | "constant": true, 322 | "inputs": [], 323 | "name": "decimals", 324 | "outputs": [ 325 | { 326 | "internalType": "uint8", 327 | "name": "", 328 | "type": "uint8" 329 | } 330 | ], 331 | "payable": false, 332 | "stateMutability": "view", 333 | "type": "function" 334 | }, 335 | { 336 | "constant": true, 337 | "inputs": [], 338 | "name": "factory", 339 | "outputs": [ 340 | { 341 | "internalType": "address", 342 | "name": "", 343 | "type": "address" 344 | } 345 | ], 346 | "payable": false, 347 | "stateMutability": "view", 348 | "type": "function" 349 | }, 350 | { 351 | "constant": true, 352 | "inputs": [], 353 | "name": "getReserves", 354 | "outputs": [ 355 | { 356 | "internalType": "uint112", 357 | "name": "_reserve0", 358 | "type": "uint112" 359 | }, 360 | { 361 | "internalType": "uint112", 362 | "name": "_reserve1", 363 | "type": "uint112" 364 | }, 365 | { 366 | "internalType": "uint32", 367 | "name": "_blockTimestampLast", 368 | "type": "uint32" 369 | } 370 | ], 371 | "payable": false, 372 | "stateMutability": "view", 373 | "type": "function" 374 | }, 375 | { 376 | "constant": false, 377 | "inputs": [ 378 | { 379 | "internalType": "address", 380 | "name": "_token0", 381 | "type": "address" 382 | }, 383 | { 384 | "internalType": "address", 385 | "name": "_token1", 386 | "type": "address" 387 | } 388 | ], 389 | "name": "initialize", 390 | "outputs": [], 391 | "payable": false, 392 | "stateMutability": "nonpayable", 393 | "type": "function" 394 | }, 395 | { 396 | "constant": true, 397 | "inputs": [], 398 | "name": "kLast", 399 | "outputs": [ 400 | { 401 | "internalType": "uint256", 402 | "name": "", 403 | "type": "uint256" 404 | } 405 | ], 406 | "payable": false, 407 | "stateMutability": "view", 408 | "type": "function" 409 | }, 410 | { 411 | "constant": false, 412 | "inputs": [ 413 | { 414 | "internalType": "address", 415 | "name": "to", 416 | "type": "address" 417 | } 418 | ], 419 | "name": "mint", 420 | "outputs": [ 421 | { 422 | "internalType": "uint256", 423 | "name": "liquidity", 424 | "type": "uint256" 425 | } 426 | ], 427 | "payable": false, 428 | "stateMutability": "nonpayable", 429 | "type": "function" 430 | }, 431 | { 432 | "constant": true, 433 | "inputs": [], 434 | "name": "name", 435 | "outputs": [ 436 | { 437 | "internalType": "string", 438 | "name": "", 439 | "type": "string" 440 | } 441 | ], 442 | "payable": false, 443 | "stateMutability": "view", 444 | "type": "function" 445 | }, 446 | { 447 | "constant": true, 448 | "inputs": [ 449 | { 450 | "internalType": "address", 451 | "name": "", 452 | "type": "address" 453 | } 454 | ], 455 | "name": "nonces", 456 | "outputs": [ 457 | { 458 | "internalType": "uint256", 459 | "name": "", 460 | "type": "uint256" 461 | } 462 | ], 463 | "payable": false, 464 | "stateMutability": "view", 465 | "type": "function" 466 | }, 467 | { 468 | "constant": false, 469 | "inputs": [ 470 | { 471 | "internalType": "address", 472 | "name": "owner", 473 | "type": "address" 474 | }, 475 | { 476 | "internalType": "address", 477 | "name": "spender", 478 | "type": "address" 479 | }, 480 | { 481 | "internalType": "uint256", 482 | "name": "value", 483 | "type": "uint256" 484 | }, 485 | { 486 | "internalType": "uint256", 487 | "name": "deadline", 488 | "type": "uint256" 489 | }, 490 | { 491 | "internalType": "uint8", 492 | "name": "v", 493 | "type": "uint8" 494 | }, 495 | { 496 | "internalType": "bytes32", 497 | "name": "r", 498 | "type": "bytes32" 499 | }, 500 | { 501 | "internalType": "bytes32", 502 | "name": "s", 503 | "type": "bytes32" 504 | } 505 | ], 506 | "name": "permit", 507 | "outputs": [], 508 | "payable": false, 509 | "stateMutability": "nonpayable", 510 | "type": "function" 511 | }, 512 | { 513 | "constant": true, 514 | "inputs": [], 515 | "name": "price0CumulativeLast", 516 | "outputs": [ 517 | { 518 | "internalType": "uint256", 519 | "name": "", 520 | "type": "uint256" 521 | } 522 | ], 523 | "payable": false, 524 | "stateMutability": "view", 525 | "type": "function" 526 | }, 527 | { 528 | "constant": true, 529 | "inputs": [], 530 | "name": "price1CumulativeLast", 531 | "outputs": [ 532 | { 533 | "internalType": "uint256", 534 | "name": "", 535 | "type": "uint256" 536 | } 537 | ], 538 | "payable": false, 539 | "stateMutability": "view", 540 | "type": "function" 541 | }, 542 | { 543 | "constant": false, 544 | "inputs": [ 545 | { 546 | "internalType": "address", 547 | "name": "to", 548 | "type": "address" 549 | } 550 | ], 551 | "name": "skim", 552 | "outputs": [], 553 | "payable": false, 554 | "stateMutability": "nonpayable", 555 | "type": "function" 556 | }, 557 | { 558 | "constant": false, 559 | "inputs": [ 560 | { 561 | "internalType": "uint256", 562 | "name": "amount0Out", 563 | "type": "uint256" 564 | }, 565 | { 566 | "internalType": "uint256", 567 | "name": "amount1Out", 568 | "type": "uint256" 569 | }, 570 | { 571 | "internalType": "address", 572 | "name": "to", 573 | "type": "address" 574 | }, 575 | { 576 | "internalType": "bytes", 577 | "name": "data", 578 | "type": "bytes" 579 | } 580 | ], 581 | "name": "swap", 582 | "outputs": [], 583 | "payable": false, 584 | "stateMutability": "nonpayable", 585 | "type": "function" 586 | }, 587 | { 588 | "constant": true, 589 | "inputs": [], 590 | "name": "symbol", 591 | "outputs": [ 592 | { 593 | "internalType": "string", 594 | "name": "", 595 | "type": "string" 596 | } 597 | ], 598 | "payable": false, 599 | "stateMutability": "view", 600 | "type": "function" 601 | }, 602 | { 603 | "constant": false, 604 | "inputs": [], 605 | "name": "sync", 606 | "outputs": [], 607 | "payable": false, 608 | "stateMutability": "nonpayable", 609 | "type": "function" 610 | }, 611 | { 612 | "constant": true, 613 | "inputs": [], 614 | "name": "token0", 615 | "outputs": [ 616 | { 617 | "internalType": "address", 618 | "name": "", 619 | "type": "address" 620 | } 621 | ], 622 | "payable": false, 623 | "stateMutability": "view", 624 | "type": "function" 625 | }, 626 | { 627 | "constant": true, 628 | "inputs": [], 629 | "name": "token1", 630 | "outputs": [ 631 | { 632 | "internalType": "address", 633 | "name": "", 634 | "type": "address" 635 | } 636 | ], 637 | "payable": false, 638 | "stateMutability": "view", 639 | "type": "function" 640 | }, 641 | { 642 | "constant": true, 643 | "inputs": [], 644 | "name": "totalSupply", 645 | "outputs": [ 646 | { 647 | "internalType": "uint256", 648 | "name": "", 649 | "type": "uint256" 650 | } 651 | ], 652 | "payable": false, 653 | "stateMutability": "view", 654 | "type": "function" 655 | }, 656 | { 657 | "constant": false, 658 | "inputs": [ 659 | { 660 | "internalType": "address", 661 | "name": "to", 662 | "type": "address" 663 | }, 664 | { 665 | "internalType": "uint256", 666 | "name": "value", 667 | "type": "uint256" 668 | } 669 | ], 670 | "name": "transfer", 671 | "outputs": [ 672 | { 673 | "internalType": "bool", 674 | "name": "", 675 | "type": "bool" 676 | } 677 | ], 678 | "payable": false, 679 | "stateMutability": "nonpayable", 680 | "type": "function" 681 | }, 682 | { 683 | "constant": false, 684 | "inputs": [ 685 | { 686 | "internalType": "address", 687 | "name": "from", 688 | "type": "address" 689 | }, 690 | { 691 | "internalType": "address", 692 | "name": "to", 693 | "type": "address" 694 | }, 695 | { 696 | "internalType": "uint256", 697 | "name": "value", 698 | "type": "uint256" 699 | } 700 | ], 701 | "name": "transferFrom", 702 | "outputs": [ 703 | { 704 | "internalType": "bool", 705 | "name": "", 706 | "type": "bool" 707 | } 708 | ], 709 | "payable": false, 710 | "stateMutability": "nonpayable", 711 | "type": "function" 712 | } 713 | ] -------------------------------------------------------------------------------- /src/pancakeswap/contracts/PancakeRouter.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_factory", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_WETH", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "inputs": [], 20 | "name": "WETH", 21 | "outputs": [ 22 | { 23 | "internalType": "address", 24 | "name": "", 25 | "type": "address" 26 | } 27 | ], 28 | "stateMutability": "view", 29 | "type": "function" 30 | }, 31 | { 32 | "inputs": [ 33 | { 34 | "internalType": "address", 35 | "name": "tokenA", 36 | "type": "address" 37 | }, 38 | { 39 | "internalType": "address", 40 | "name": "tokenB", 41 | "type": "address" 42 | }, 43 | { 44 | "internalType": "uint256", 45 | "name": "amountADesired", 46 | "type": "uint256" 47 | }, 48 | { 49 | "internalType": "uint256", 50 | "name": "amountBDesired", 51 | "type": "uint256" 52 | }, 53 | { 54 | "internalType": "uint256", 55 | "name": "amountAMin", 56 | "type": "uint256" 57 | }, 58 | { 59 | "internalType": "uint256", 60 | "name": "amountBMin", 61 | "type": "uint256" 62 | }, 63 | { 64 | "internalType": "address", 65 | "name": "to", 66 | "type": "address" 67 | }, 68 | { 69 | "internalType": "uint256", 70 | "name": "deadline", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "addLiquidity", 75 | "outputs": [ 76 | { 77 | "internalType": "uint256", 78 | "name": "amountA", 79 | "type": "uint256" 80 | }, 81 | { 82 | "internalType": "uint256", 83 | "name": "amountB", 84 | "type": "uint256" 85 | }, 86 | { 87 | "internalType": "uint256", 88 | "name": "liquidity", 89 | "type": "uint256" 90 | } 91 | ], 92 | "stateMutability": "nonpayable", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [ 97 | { 98 | "internalType": "address", 99 | "name": "token", 100 | "type": "address" 101 | }, 102 | { 103 | "internalType": "uint256", 104 | "name": "amountTokenDesired", 105 | "type": "uint256" 106 | }, 107 | { 108 | "internalType": "uint256", 109 | "name": "amountTokenMin", 110 | "type": "uint256" 111 | }, 112 | { 113 | "internalType": "uint256", 114 | "name": "amountETHMin", 115 | "type": "uint256" 116 | }, 117 | { 118 | "internalType": "address", 119 | "name": "to", 120 | "type": "address" 121 | }, 122 | { 123 | "internalType": "uint256", 124 | "name": "deadline", 125 | "type": "uint256" 126 | } 127 | ], 128 | "name": "addLiquidityETH", 129 | "outputs": [ 130 | { 131 | "internalType": "uint256", 132 | "name": "amountToken", 133 | "type": "uint256" 134 | }, 135 | { 136 | "internalType": "uint256", 137 | "name": "amountETH", 138 | "type": "uint256" 139 | }, 140 | { 141 | "internalType": "uint256", 142 | "name": "liquidity", 143 | "type": "uint256" 144 | } 145 | ], 146 | "stateMutability": "payable", 147 | "type": "function" 148 | }, 149 | { 150 | "inputs": [], 151 | "name": "factory", 152 | "outputs": [ 153 | { 154 | "internalType": "address", 155 | "name": "", 156 | "type": "address" 157 | } 158 | ], 159 | "stateMutability": "view", 160 | "type": "function" 161 | }, 162 | { 163 | "inputs": [ 164 | { 165 | "internalType": "uint256", 166 | "name": "amountOut", 167 | "type": "uint256" 168 | }, 169 | { 170 | "internalType": "uint256", 171 | "name": "reserveIn", 172 | "type": "uint256" 173 | }, 174 | { 175 | "internalType": "uint256", 176 | "name": "reserveOut", 177 | "type": "uint256" 178 | } 179 | ], 180 | "name": "getAmountIn", 181 | "outputs": [ 182 | { 183 | "internalType": "uint256", 184 | "name": "amountIn", 185 | "type": "uint256" 186 | } 187 | ], 188 | "stateMutability": "pure", 189 | "type": "function" 190 | }, 191 | { 192 | "inputs": [ 193 | { 194 | "internalType": "uint256", 195 | "name": "amountIn", 196 | "type": "uint256" 197 | }, 198 | { 199 | "internalType": "uint256", 200 | "name": "reserveIn", 201 | "type": "uint256" 202 | }, 203 | { 204 | "internalType": "uint256", 205 | "name": "reserveOut", 206 | "type": "uint256" 207 | } 208 | ], 209 | "name": "getAmountOut", 210 | "outputs": [ 211 | { 212 | "internalType": "uint256", 213 | "name": "amountOut", 214 | "type": "uint256" 215 | } 216 | ], 217 | "stateMutability": "pure", 218 | "type": "function" 219 | }, 220 | { 221 | "inputs": [ 222 | { 223 | "internalType": "uint256", 224 | "name": "amountOut", 225 | "type": "uint256" 226 | }, 227 | { 228 | "internalType": "address[]", 229 | "name": "path", 230 | "type": "address[]" 231 | } 232 | ], 233 | "name": "getAmountsIn", 234 | "outputs": [ 235 | { 236 | "internalType": "uint256[]", 237 | "name": "amounts", 238 | "type": "uint256[]" 239 | } 240 | ], 241 | "stateMutability": "view", 242 | "type": "function" 243 | }, 244 | { 245 | "inputs": [ 246 | { 247 | "internalType": "uint256", 248 | "name": "amountIn", 249 | "type": "uint256" 250 | }, 251 | { 252 | "internalType": "address[]", 253 | "name": "path", 254 | "type": "address[]" 255 | } 256 | ], 257 | "name": "getAmountsOut", 258 | "outputs": [ 259 | { 260 | "internalType": "uint256[]", 261 | "name": "amounts", 262 | "type": "uint256[]" 263 | } 264 | ], 265 | "stateMutability": "view", 266 | "type": "function" 267 | }, 268 | { 269 | "inputs": [ 270 | { 271 | "internalType": "uint256", 272 | "name": "amountA", 273 | "type": "uint256" 274 | }, 275 | { 276 | "internalType": "uint256", 277 | "name": "reserveA", 278 | "type": "uint256" 279 | }, 280 | { 281 | "internalType": "uint256", 282 | "name": "reserveB", 283 | "type": "uint256" 284 | } 285 | ], 286 | "name": "quote", 287 | "outputs": [ 288 | { 289 | "internalType": "uint256", 290 | "name": "amountB", 291 | "type": "uint256" 292 | } 293 | ], 294 | "stateMutability": "pure", 295 | "type": "function" 296 | }, 297 | { 298 | "inputs": [ 299 | { 300 | "internalType": "address", 301 | "name": "tokenA", 302 | "type": "address" 303 | }, 304 | { 305 | "internalType": "address", 306 | "name": "tokenB", 307 | "type": "address" 308 | }, 309 | { 310 | "internalType": "uint256", 311 | "name": "liquidity", 312 | "type": "uint256" 313 | }, 314 | { 315 | "internalType": "uint256", 316 | "name": "amountAMin", 317 | "type": "uint256" 318 | }, 319 | { 320 | "internalType": "uint256", 321 | "name": "amountBMin", 322 | "type": "uint256" 323 | }, 324 | { 325 | "internalType": "address", 326 | "name": "to", 327 | "type": "address" 328 | }, 329 | { 330 | "internalType": "uint256", 331 | "name": "deadline", 332 | "type": "uint256" 333 | } 334 | ], 335 | "name": "removeLiquidity", 336 | "outputs": [ 337 | { 338 | "internalType": "uint256", 339 | "name": "amountA", 340 | "type": "uint256" 341 | }, 342 | { 343 | "internalType": "uint256", 344 | "name": "amountB", 345 | "type": "uint256" 346 | } 347 | ], 348 | "stateMutability": "nonpayable", 349 | "type": "function" 350 | }, 351 | { 352 | "inputs": [ 353 | { 354 | "internalType": "address", 355 | "name": "token", 356 | "type": "address" 357 | }, 358 | { 359 | "internalType": "uint256", 360 | "name": "liquidity", 361 | "type": "uint256" 362 | }, 363 | { 364 | "internalType": "uint256", 365 | "name": "amountTokenMin", 366 | "type": "uint256" 367 | }, 368 | { 369 | "internalType": "uint256", 370 | "name": "amountETHMin", 371 | "type": "uint256" 372 | }, 373 | { 374 | "internalType": "address", 375 | "name": "to", 376 | "type": "address" 377 | }, 378 | { 379 | "internalType": "uint256", 380 | "name": "deadline", 381 | "type": "uint256" 382 | } 383 | ], 384 | "name": "removeLiquidityETH", 385 | "outputs": [ 386 | { 387 | "internalType": "uint256", 388 | "name": "amountToken", 389 | "type": "uint256" 390 | }, 391 | { 392 | "internalType": "uint256", 393 | "name": "amountETH", 394 | "type": "uint256" 395 | } 396 | ], 397 | "stateMutability": "nonpayable", 398 | "type": "function" 399 | }, 400 | { 401 | "inputs": [ 402 | { 403 | "internalType": "address", 404 | "name": "token", 405 | "type": "address" 406 | }, 407 | { 408 | "internalType": "uint256", 409 | "name": "liquidity", 410 | "type": "uint256" 411 | }, 412 | { 413 | "internalType": "uint256", 414 | "name": "amountTokenMin", 415 | "type": "uint256" 416 | }, 417 | { 418 | "internalType": "uint256", 419 | "name": "amountETHMin", 420 | "type": "uint256" 421 | }, 422 | { 423 | "internalType": "address", 424 | "name": "to", 425 | "type": "address" 426 | }, 427 | { 428 | "internalType": "uint256", 429 | "name": "deadline", 430 | "type": "uint256" 431 | } 432 | ], 433 | "name": "removeLiquidityETHSupportingFeeOnTransferTokens", 434 | "outputs": [ 435 | { 436 | "internalType": "uint256", 437 | "name": "amountETH", 438 | "type": "uint256" 439 | } 440 | ], 441 | "stateMutability": "nonpayable", 442 | "type": "function" 443 | }, 444 | { 445 | "inputs": [ 446 | { 447 | "internalType": "address", 448 | "name": "token", 449 | "type": "address" 450 | }, 451 | { 452 | "internalType": "uint256", 453 | "name": "liquidity", 454 | "type": "uint256" 455 | }, 456 | { 457 | "internalType": "uint256", 458 | "name": "amountTokenMin", 459 | "type": "uint256" 460 | }, 461 | { 462 | "internalType": "uint256", 463 | "name": "amountETHMin", 464 | "type": "uint256" 465 | }, 466 | { 467 | "internalType": "address", 468 | "name": "to", 469 | "type": "address" 470 | }, 471 | { 472 | "internalType": "uint256", 473 | "name": "deadline", 474 | "type": "uint256" 475 | }, 476 | { 477 | "internalType": "bool", 478 | "name": "approveMax", 479 | "type": "bool" 480 | }, 481 | { 482 | "internalType": "uint8", 483 | "name": "v", 484 | "type": "uint8" 485 | }, 486 | { 487 | "internalType": "bytes32", 488 | "name": "r", 489 | "type": "bytes32" 490 | }, 491 | { 492 | "internalType": "bytes32", 493 | "name": "s", 494 | "type": "bytes32" 495 | } 496 | ], 497 | "name": "removeLiquidityETHWithPermit", 498 | "outputs": [ 499 | { 500 | "internalType": "uint256", 501 | "name": "amountToken", 502 | "type": "uint256" 503 | }, 504 | { 505 | "internalType": "uint256", 506 | "name": "amountETH", 507 | "type": "uint256" 508 | } 509 | ], 510 | "stateMutability": "nonpayable", 511 | "type": "function" 512 | }, 513 | { 514 | "inputs": [ 515 | { 516 | "internalType": "address", 517 | "name": "token", 518 | "type": "address" 519 | }, 520 | { 521 | "internalType": "uint256", 522 | "name": "liquidity", 523 | "type": "uint256" 524 | }, 525 | { 526 | "internalType": "uint256", 527 | "name": "amountTokenMin", 528 | "type": "uint256" 529 | }, 530 | { 531 | "internalType": "uint256", 532 | "name": "amountETHMin", 533 | "type": "uint256" 534 | }, 535 | { 536 | "internalType": "address", 537 | "name": "to", 538 | "type": "address" 539 | }, 540 | { 541 | "internalType": "uint256", 542 | "name": "deadline", 543 | "type": "uint256" 544 | }, 545 | { 546 | "internalType": "bool", 547 | "name": "approveMax", 548 | "type": "bool" 549 | }, 550 | { 551 | "internalType": "uint8", 552 | "name": "v", 553 | "type": "uint8" 554 | }, 555 | { 556 | "internalType": "bytes32", 557 | "name": "r", 558 | "type": "bytes32" 559 | }, 560 | { 561 | "internalType": "bytes32", 562 | "name": "s", 563 | "type": "bytes32" 564 | } 565 | ], 566 | "name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", 567 | "outputs": [ 568 | { 569 | "internalType": "uint256", 570 | "name": "amountETH", 571 | "type": "uint256" 572 | } 573 | ], 574 | "stateMutability": "nonpayable", 575 | "type": "function" 576 | }, 577 | { 578 | "inputs": [ 579 | { 580 | "internalType": "address", 581 | "name": "tokenA", 582 | "type": "address" 583 | }, 584 | { 585 | "internalType": "address", 586 | "name": "tokenB", 587 | "type": "address" 588 | }, 589 | { 590 | "internalType": "uint256", 591 | "name": "liquidity", 592 | "type": "uint256" 593 | }, 594 | { 595 | "internalType": "uint256", 596 | "name": "amountAMin", 597 | "type": "uint256" 598 | }, 599 | { 600 | "internalType": "uint256", 601 | "name": "amountBMin", 602 | "type": "uint256" 603 | }, 604 | { 605 | "internalType": "address", 606 | "name": "to", 607 | "type": "address" 608 | }, 609 | { 610 | "internalType": "uint256", 611 | "name": "deadline", 612 | "type": "uint256" 613 | }, 614 | { 615 | "internalType": "bool", 616 | "name": "approveMax", 617 | "type": "bool" 618 | }, 619 | { 620 | "internalType": "uint8", 621 | "name": "v", 622 | "type": "uint8" 623 | }, 624 | { 625 | "internalType": "bytes32", 626 | "name": "r", 627 | "type": "bytes32" 628 | }, 629 | { 630 | "internalType": "bytes32", 631 | "name": "s", 632 | "type": "bytes32" 633 | } 634 | ], 635 | "name": "removeLiquidityWithPermit", 636 | "outputs": [ 637 | { 638 | "internalType": "uint256", 639 | "name": "amountA", 640 | "type": "uint256" 641 | }, 642 | { 643 | "internalType": "uint256", 644 | "name": "amountB", 645 | "type": "uint256" 646 | } 647 | ], 648 | "stateMutability": "nonpayable", 649 | "type": "function" 650 | }, 651 | { 652 | "inputs": [ 653 | { 654 | "internalType": "uint256", 655 | "name": "amountOut", 656 | "type": "uint256" 657 | }, 658 | { 659 | "internalType": "address[]", 660 | "name": "path", 661 | "type": "address[]" 662 | }, 663 | { 664 | "internalType": "address", 665 | "name": "to", 666 | "type": "address" 667 | }, 668 | { 669 | "internalType": "uint256", 670 | "name": "deadline", 671 | "type": "uint256" 672 | } 673 | ], 674 | "name": "swapETHForExactTokens", 675 | "outputs": [ 676 | { 677 | "internalType": "uint256[]", 678 | "name": "amounts", 679 | "type": "uint256[]" 680 | } 681 | ], 682 | "stateMutability": "payable", 683 | "type": "function" 684 | }, 685 | { 686 | "inputs": [ 687 | { 688 | "internalType": "uint256", 689 | "name": "amountOutMin", 690 | "type": "uint256" 691 | }, 692 | { 693 | "internalType": "address[]", 694 | "name": "path", 695 | "type": "address[]" 696 | }, 697 | { 698 | "internalType": "address", 699 | "name": "to", 700 | "type": "address" 701 | }, 702 | { 703 | "internalType": "uint256", 704 | "name": "deadline", 705 | "type": "uint256" 706 | } 707 | ], 708 | "name": "swapExactETHForTokens", 709 | "outputs": [ 710 | { 711 | "internalType": "uint256[]", 712 | "name": "amounts", 713 | "type": "uint256[]" 714 | } 715 | ], 716 | "stateMutability": "payable", 717 | "type": "function" 718 | }, 719 | { 720 | "inputs": [ 721 | { 722 | "internalType": "uint256", 723 | "name": "amountOutMin", 724 | "type": "uint256" 725 | }, 726 | { 727 | "internalType": "address[]", 728 | "name": "path", 729 | "type": "address[]" 730 | }, 731 | { 732 | "internalType": "address", 733 | "name": "to", 734 | "type": "address" 735 | }, 736 | { 737 | "internalType": "uint256", 738 | "name": "deadline", 739 | "type": "uint256" 740 | } 741 | ], 742 | "name": "swapExactETHForTokensSupportingFeeOnTransferTokens", 743 | "outputs": [], 744 | "stateMutability": "payable", 745 | "type": "function" 746 | }, 747 | { 748 | "inputs": [ 749 | { 750 | "internalType": "uint256", 751 | "name": "amountIn", 752 | "type": "uint256" 753 | }, 754 | { 755 | "internalType": "uint256", 756 | "name": "amountOutMin", 757 | "type": "uint256" 758 | }, 759 | { 760 | "internalType": "address[]", 761 | "name": "path", 762 | "type": "address[]" 763 | }, 764 | { 765 | "internalType": "address", 766 | "name": "to", 767 | "type": "address" 768 | }, 769 | { 770 | "internalType": "uint256", 771 | "name": "deadline", 772 | "type": "uint256" 773 | } 774 | ], 775 | "name": "swapExactTokensForETH", 776 | "outputs": [ 777 | { 778 | "internalType": "uint256[]", 779 | "name": "amounts", 780 | "type": "uint256[]" 781 | } 782 | ], 783 | "stateMutability": "nonpayable", 784 | "type": "function" 785 | }, 786 | { 787 | "inputs": [ 788 | { 789 | "internalType": "uint256", 790 | "name": "amountIn", 791 | "type": "uint256" 792 | }, 793 | { 794 | "internalType": "uint256", 795 | "name": "amountOutMin", 796 | "type": "uint256" 797 | }, 798 | { 799 | "internalType": "address[]", 800 | "name": "path", 801 | "type": "address[]" 802 | }, 803 | { 804 | "internalType": "address", 805 | "name": "to", 806 | "type": "address" 807 | }, 808 | { 809 | "internalType": "uint256", 810 | "name": "deadline", 811 | "type": "uint256" 812 | } 813 | ], 814 | "name": "swapExactTokensForETHSupportingFeeOnTransferTokens", 815 | "outputs": [], 816 | "stateMutability": "nonpayable", 817 | "type": "function" 818 | }, 819 | { 820 | "inputs": [ 821 | { 822 | "internalType": "uint256", 823 | "name": "amountIn", 824 | "type": "uint256" 825 | }, 826 | { 827 | "internalType": "uint256", 828 | "name": "amountOutMin", 829 | "type": "uint256" 830 | }, 831 | { 832 | "internalType": "address[]", 833 | "name": "path", 834 | "type": "address[]" 835 | }, 836 | { 837 | "internalType": "address", 838 | "name": "to", 839 | "type": "address" 840 | }, 841 | { 842 | "internalType": "uint256", 843 | "name": "deadline", 844 | "type": "uint256" 845 | } 846 | ], 847 | "name": "swapExactTokensForTokens", 848 | "outputs": [ 849 | { 850 | "internalType": "uint256[]", 851 | "name": "amounts", 852 | "type": "uint256[]" 853 | } 854 | ], 855 | "stateMutability": "nonpayable", 856 | "type": "function" 857 | }, 858 | { 859 | "inputs": [ 860 | { 861 | "internalType": "uint256", 862 | "name": "amountIn", 863 | "type": "uint256" 864 | }, 865 | { 866 | "internalType": "uint256", 867 | "name": "amountOutMin", 868 | "type": "uint256" 869 | }, 870 | { 871 | "internalType": "address[]", 872 | "name": "path", 873 | "type": "address[]" 874 | }, 875 | { 876 | "internalType": "address", 877 | "name": "to", 878 | "type": "address" 879 | }, 880 | { 881 | "internalType": "uint256", 882 | "name": "deadline", 883 | "type": "uint256" 884 | } 885 | ], 886 | "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens", 887 | "outputs": [], 888 | "stateMutability": "nonpayable", 889 | "type": "function" 890 | }, 891 | { 892 | "inputs": [ 893 | { 894 | "internalType": "uint256", 895 | "name": "amountOut", 896 | "type": "uint256" 897 | }, 898 | { 899 | "internalType": "uint256", 900 | "name": "amountInMax", 901 | "type": "uint256" 902 | }, 903 | { 904 | "internalType": "address[]", 905 | "name": "path", 906 | "type": "address[]" 907 | }, 908 | { 909 | "internalType": "address", 910 | "name": "to", 911 | "type": "address" 912 | }, 913 | { 914 | "internalType": "uint256", 915 | "name": "deadline", 916 | "type": "uint256" 917 | } 918 | ], 919 | "name": "swapTokensForExactETH", 920 | "outputs": [ 921 | { 922 | "internalType": "uint256[]", 923 | "name": "amounts", 924 | "type": "uint256[]" 925 | } 926 | ], 927 | "stateMutability": "nonpayable", 928 | "type": "function" 929 | }, 930 | { 931 | "inputs": [ 932 | { 933 | "internalType": "uint256", 934 | "name": "amountOut", 935 | "type": "uint256" 936 | }, 937 | { 938 | "internalType": "uint256", 939 | "name": "amountInMax", 940 | "type": "uint256" 941 | }, 942 | { 943 | "internalType": "address[]", 944 | "name": "path", 945 | "type": "address[]" 946 | }, 947 | { 948 | "internalType": "address", 949 | "name": "to", 950 | "type": "address" 951 | }, 952 | { 953 | "internalType": "uint256", 954 | "name": "deadline", 955 | "type": "uint256" 956 | } 957 | ], 958 | "name": "swapTokensForExactTokens", 959 | "outputs": [ 960 | { 961 | "internalType": "uint256[]", 962 | "name": "amounts", 963 | "type": "uint256[]" 964 | } 965 | ], 966 | "stateMutability": "nonpayable", 967 | "type": "function" 968 | }, 969 | { 970 | "stateMutability": "payable", 971 | "type": "receive" 972 | } 973 | ] -------------------------------------------------------------------------------- /src/pancakeswap/interact.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers' 2 | import bep20Abi from './contracts/BEP20.json' 3 | import pancakeRouterAbi from './contracts/PancakeRouter.json' 4 | 5 | interface TokenMap { 6 | [key: string]: string 7 | } 8 | 9 | export async function pumpOrDump(token1: string, token2: string, action: string) { 10 | 11 | const { PRIVATE_KEY } = process.env 12 | 13 | if (!PRIVATE_KEY) { 14 | console.log('Private key missing from env variables') 15 | return 16 | } 17 | 18 | const tokenMap: TokenMap = { 19 | 'WBNB': '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 20 | 'ACH': '0xBc7d6B50616989655AfD682fb42743507003056D' 21 | } 22 | 23 | const pancakeRouterAddress = '0x10ED43C718714eb63d5aA57B78B54704E256024E' 24 | 25 | // Connect to the BSC mainnet 26 | const provider = new ethers.providers.JsonRpcProvider( 27 | 'https://bsc-dataseed.binance.org/' 28 | ); 29 | 30 | // Sign the transaction with the contract owner's private key 31 | const wallet = new ethers.Wallet(PRIVATE_KEY, provider); 32 | 33 | // Get the contract instance 34 | const pancakeRouterContract = new ethers.Contract(pancakeRouterAddress, pancakeRouterAbi, wallet) 35 | 36 | const token1Address = tokenMap[token1] || token1 37 | const token2Address = tokenMap[token2] || token2 38 | 39 | const token1Contract = new ethers.Contract(token1Address, bep20Abi, wallet) 40 | const token2Contract = new ethers.Contract(token2Address, bep20Abi, wallet) 41 | 42 | const providedGasPrice = await provider.getGasPrice() 43 | const gasPrice = ethers.BigNumber.from(providedGasPrice.toNumber() * 1.2) 44 | 45 | const walletAddress = await wallet.getAddress() 46 | const walletBalance = await wallet.getBalance() 47 | 48 | const token1Balance: ethers.BigNumber = await token1Contract.balanceOf(walletAddress) 49 | const token2Balance: ethers.BigNumber = await token2Contract.balanceOf(walletAddress) 50 | 51 | console.log(walletAddress + ':', walletBalance.toBigInt()) 52 | console.log('TOKEN1:', token1Balance.toBigInt(), 'TOKEN2:', token2Balance.toBigInt()) 53 | console.log('GAS PRICE:', gasPrice.toNumber()) 54 | 55 | const expirationTimestamp = Math.floor((Date.now() / 1000) + (60 * 60)) 56 | 57 | let fromContract = token2Contract 58 | let fromAddress = token2Address 59 | let toAddress = token1Address 60 | let amount = token2Balance 61 | if (action === 'pump') { 62 | fromContract = token1Contract 63 | fromAddress = token1Address 64 | toAddress = token2Address 65 | amount = token1Balance 66 | } 67 | 68 | const allowance: ethers.BigNumber = await fromContract.allowance(walletAddress, pancakeRouterAddress) 69 | console.log(`ALLOWANCE: ${allowance.toBigInt()}`) 70 | if (allowance.lt(amount)) { 71 | const approvalResult = await fromContract.approve(pancakeRouterAddress, amount) 72 | console.log(`Spending of ${amount.toBigInt()} approved.`) 73 | } 74 | 75 | const txInputs = [ 76 | amount, 77 | 0, 78 | [ fromAddress, toAddress ], 79 | walletAddress, 80 | expirationTimestamp 81 | ] 82 | 83 | let gasLimit = ethers.BigNumber.from(500000) 84 | 85 | try { 86 | const gasEstimate = await pancakeRouterContract.estimateGas.swapExactTokensForTokens(...txInputs) 87 | gasLimit = ethers.BigNumber.from(gasEstimate.toNumber() * 3) 88 | console.log(`GAS LIMIT: ${gasLimit.toNumber()}/${gasEstimate.toNumber()}`) 89 | } catch (error) { 90 | console.log(`DEFAULT GAS LIMIT: ${gasLimit.toNumber()}`) 91 | } 92 | 93 | console.log(`GAS PRICE: ${gasPrice.toNumber()}/${providedGasPrice}`) 94 | 95 | const result = await pancakeRouterContract.swapExactTokensForTokens(...txInputs, { gasPrice, gasLimit }) 96 | 97 | return result 98 | 99 | } 100 | 101 | -------------------------------------------------------------------------------- /src/pumpOrDump.ts: -------------------------------------------------------------------------------- 1 | import { pumpOrDump } from './pancakeswap/interact' 2 | import { promisify } from 'util' 3 | 4 | const token1 = process.argv[2] 5 | const token2 = process.argv[3] 6 | const action = process.argv[4] 7 | 8 | const main = promisify(async () => { 9 | await pumpOrDump(token1, token2, action) 10 | }) 11 | 12 | main().then(() => { 13 | console.log('Async operation completed') 14 | }) 15 | -------------------------------------------------------------------------------- /src/uniswap/contracts/ERC20.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"childChainManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"address payable","name":"relayerAddress","type":"address"},{"indexed":false,"internalType":"bytes","name":"functionSignature","type":"bytes"}],"name":"MetaTransactionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"CHILD_CHAIN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CHILD_CHAIN_ID_BYTES","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPOSITOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ERC712_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROOT_CHAIN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROOT_CHAIN_ID_BYTES","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes","name":"depositData","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"bytes","name":"functionSignature","type":"bytes"},{"internalType":"bytes32","name":"sigR","type":"bytes32"},{"internalType":"bytes32","name":"sigS","type":"bytes32"},{"internalType":"uint8","name":"sigV","type":"uint8"}],"name":"executeMetaTransaction","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getDomainSeperator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /src/uniswap/contracts/SwapRouter.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct ISwapRouter.ExactInputParams","name":"params","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct ISwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct ISwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct ISwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}] -------------------------------------------------------------------------------- /src/uniswap/contracts/UniswapV3Factory.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":true,"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"FeeAmountEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":false,"internalType":"int24","name":"tickSpacing","type":"int24"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolCreated","type":"event"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createPool","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"enableFeeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"","type":"uint24"}],"name":"feeAmountTickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameters","outputs":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /src/uniswap/contracts/UniswapV3Pool.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"feeProtocol0","type":"uint8"},{"internalType":"uint8","name":"feeProtocol1","type":"uint8"}],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /src/uniswap/quote.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from 'ethers' 2 | import uniswapV3FactoryAbi from './contracts/UniswapV3Factory.json' 3 | import uniswapV3PoolAbi from './contracts/UniswapV3Pool.json' 4 | 5 | export async function quotePair() { 6 | 7 | const uniswapV3FactoryAddress = '0x1F98431c8aD98523631AE4a59f267346ea31F984' 8 | const { PRIVATE_KEY } = process.env 9 | 10 | if (!PRIVATE_KEY) { 11 | console.log('Private key missing from env variables') 12 | return 13 | } 14 | 15 | // Connect to the BSC mainnet 16 | // const provider = ethers.getDefaultProvider(); 17 | const provider = new ethers.providers.JsonRpcProvider( 18 | 'https://polygon-rpc.com/' 19 | ); 20 | 21 | // Sign the transaction with the contract owner's private key 22 | const wallet = new ethers.Wallet(PRIVATE_KEY, provider); 23 | 24 | // Get the contract instance 25 | const factoryContract = new ethers.Contract(uniswapV3FactoryAddress, uniswapV3FactoryAbi, wallet) 26 | 27 | const walletAddress = await wallet.getAddress() 28 | const walletBalance = await wallet.getBalance() 29 | 30 | console.log(walletAddress + ':', walletBalance.toBigInt()) 31 | 32 | const tokenAAddress = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' // USDC 33 | const tokenBAddress = '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619' // WETH 34 | 35 | const txInputs = [ 36 | tokenAAddress, 37 | tokenBAddress, 38 | 3000 39 | ] 40 | 41 | const poolAddress = await factoryContract.getPool(...txInputs) 42 | console.log('Pool address:', poolAddress) 43 | 44 | const poolContract = new ethers.Contract(poolAddress, uniswapV3PoolAbi, wallet) 45 | const slot0 = await poolContract.slot0() 46 | 47 | const { tick } = slot0 48 | const tokenBPrice = 1 / ((1.0001 ** tick) * (10 ** -12)) 49 | 50 | console.log('Tick:', tick, 'Price:', tokenBPrice) 51 | 52 | return tokenBPrice 53 | 54 | } 55 | 56 | -------------------------------------------------------------------------------- /src/uniswap/swap.ts: -------------------------------------------------------------------------------- 1 | import { BigNumber, Contract } from 'ethers' 2 | import { DexWallet } from '../dexWallet' 3 | import { callContractMethod } from '../contractUtils' 4 | import { waitForTx } from '../networkUtils' 5 | import erc20Abi from './contracts/ERC20.json' 6 | import swapRouterAbi from './contracts/SwapRouter.json' 7 | 8 | export async function swap(dexWallet: DexWallet, pair: [string, string], reverse?: boolean) { 9 | 10 | const { 11 | wallet, 12 | walletAddress, 13 | walletBalance, 14 | providerGasPrice 15 | } = dexWallet 16 | 17 | console.log(walletAddress + ':', walletBalance.toBigInt()) 18 | 19 | const tokenAAddress = reverse ? pair[1] : pair[0] 20 | const tokenBAddress = reverse ? pair[0] : pair[1] 21 | const tokenAContract = new Contract(tokenAAddress, erc20Abi, wallet) 22 | const tokenBContract = new Contract(tokenBAddress, erc20Abi, wallet) 23 | 24 | const tokenABalance: BigNumber = await tokenAContract.balanceOf(walletAddress) 25 | const tokenBBalance: BigNumber = await tokenBContract.balanceOf(walletAddress) 26 | 27 | console.log('Token A', tokenABalance.toBigInt(), 'Token B:', tokenBBalance.toBigInt()) 28 | 29 | const swapRouterAddress = '0xE592427A0AEce92De3Edee1F18E0157C05861564' 30 | const swapRouterContract = new Contract(swapRouterAddress, swapRouterAbi, wallet) 31 | 32 | console.log('Provider gas price:', providerGasPrice.toBigInt()) 33 | const gasPrice: BigNumber = providerGasPrice.mul(12).div(10) 34 | console.log(' Actual gas price:', gasPrice.toBigInt()) 35 | 36 | const allowance: BigNumber = await tokenAContract.allowance(walletAddress, swapRouterAddress) 37 | console.log('Token A spenditure allowance:', allowance.toBigInt()) 38 | 39 | if (allowance.lt(tokenABalance)) { 40 | const approvalResult = await callContractMethod(tokenAContract, 'approve', [swapRouterAddress, tokenABalance], gasPrice) 41 | const broadcasted = await waitForTx(wallet.provider, approvalResult.hash) 42 | if (!broadcasted) { 43 | throw new Error(`TX broadcast timeout for ${approvalResult.hash}`) 44 | } else { 45 | console.log(`Spending of ${tokenABalance.toBigInt()} approved.`) 46 | } 47 | } 48 | 49 | const swapDeadline = Math.floor((Date.now() / 1000) + (60 * 60)) 50 | const swapTxInputs = [ 51 | tokenAAddress, 52 | tokenBAddress, 53 | BigNumber.from(3000), 54 | walletAddress, 55 | BigNumber.from(swapDeadline), 56 | tokenABalance, 57 | BigNumber.from(0), 58 | BigNumber.from(0) 59 | ] 60 | 61 | const swapTxResponse = await callContractMethod(swapRouterContract, 'exactInputSingle', [swapTxInputs], gasPrice) 62 | 63 | return swapTxResponse 64 | 65 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "commonjs", /* Specify what module code is generated. */ 29 | // "rootDir": "./", /* Specify the root folder within your source files. */ 30 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [ ".ts" ], /* List of file name suffixes to search when resolving a module. */ 38 | "resolveJsonModule": true, /* Enable importing .json files. */ 39 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 40 | 41 | /* JavaScript Support */ 42 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 43 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 44 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 45 | 46 | /* Emit */ 47 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 48 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 49 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 50 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 51 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 52 | // "outDir": "./", /* Specify an output folder for all emitted files. */ 53 | // "removeComments": true, /* Disable emitting comments. */ 54 | // "noEmit": true, /* Disable emitting files from a compilation. */ 55 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 56 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 57 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 58 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 59 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 60 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 61 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 62 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 63 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 64 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 65 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 66 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 67 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 68 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 69 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 70 | 71 | /* Interop Constraints */ 72 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 73 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 74 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 75 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 76 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 77 | 78 | /* Type Checking */ 79 | "strict": true, /* Enable all strict type-checking options. */ 80 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 81 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 82 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 83 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 84 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 85 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 86 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 87 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 88 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 89 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 90 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 91 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 92 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 93 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 94 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 95 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 96 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 97 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 98 | 99 | /* Completeness */ 100 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 101 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 102 | } 103 | } 104 | --------------------------------------------------------------------------------