├── README.md ├── abi ├── Token.txt ├── classic_pool_factory_syncswap.txt ├── classic_pool_syncswap.txt ├── mute.txt ├── router_syncswap.txt ├── velocore_multicall.txt └── velocore_router.txt ├── contract_abi ├── ContractDeployer.json ├── IAllowList.json ├── IERC1271.json ├── IERC20.json ├── IEthToken.json ├── IL1Bridge.json ├── IL1Messenger.json ├── IL2Bridge.json ├── INonceHolder.json ├── IPaymasterFlow.json ├── IZkSync.json └── __init__.py ├── data └── accounts_data.xlsx ├── main.py ├── modules ├── __init__.py ├── eip712struct.py ├── func.py ├── mute.py ├── paymaster.py ├── retry.py ├── sign_messgae.py ├── syncswap.py ├── tg_bot.py ├── velocore.py └── wallet.py ├── requirements.txt └── settings.py /README.md: -------------------------------------------------------------------------------- 1 | [![Telegram channel](https://img.shields.io/endpoint?url=https://runkit.io/damiankrawczyk/telegram-badge/branches/master?url=https://t.me/developercode1)](https://t.me/developercode1) 2 | [![PyPI supported Python versions](https://img.shields.io/badge/Python%203.10.10-8A2BE2)](https://www.python.org/downloads/release/python-31010/) 3 | 4 |
5 | 6 |

ZKSYNC ERA PAYMASTER

7 |

Software on ZKSYNC ERA - includes the ability to do commission-free swaps(PAYMASTER). Available platforms: Syncswap, Mute.io, Velocore

8 |
9 | 10 | --- 11 | 12 | 🤠👉 Our tg-channel: [PYTHON DAO](https://t.me/developercode1) 13 | 14 | 🤗 Supports: elez-dev.eth 15 | 16 | --- 17 |

🙊 INFO

18 | 19 | EN: 20 | 21 | You need [Python 3.10.10](https://www.python.org/downloads/release/python-31010/) to work 22 | 23 | This guide details how to install Python - [link](https://mirror.xyz/wiedzmin.eth/ygk2pzqaTKaHmnQuV1vV-morIstKnDTJnXPpBaZwnkQ) 24 | 25 | 1. In the _data_ folder fill the Excel file with private keys 26 | 27 | 2. All the settings happen in the _settings.py_ file - each line is signed 28 | 29 | 3. Run through the _main.py_ file 30 | 31 | --- 32 | RU: 33 | 34 | Для работы нужен [Python 3.10.10](https://www.python.org/downloads/release/python-31010/) 35 | 36 | В данном гайде подробно описано как установить Python - [link](https://mirror.xyz/wiedzmin.eth/Z06W81VrxO9KI88vkcxeW0Lc8f2nBo5Wdyqce0HTNm8) 37 | 38 | 1. В папке _data_ заполняем Excel файл с приватными ключами 39 | 40 | 2. Все настройки происходят в файле _settings.py_ - каждая строчка подписана 41 | 42 | 3. Запускаем через файл _main.py_ 43 | 44 | --- 45 |

🙊 HOW IT WORKS

46 | 47 | EN: 48 | 49 | - Selects one of the three DEX 50 | - Buys (USDC,USDT) on DEX with a regular transaction 51 | - Does a paymaster approve for the USDC or USDT 52 | - Does a swap for the stablecoins 53 | - Goes to the next account or repeats the circle 54 | 55 | --- 56 | RU: 57 | 58 | - Выбирает одну из трёх свапалок 59 | - Покупает на ней стейблы(USDC,USDT) обычной транзакцией 60 | - Делает пеймастер апрув за стейблы 61 | - Делает свап за стейблы 62 | - Идет к следующем аккаунту или повторяет круг 63 | 64 | --- 65 |

🚀 INSTALLING AND RUNNING SOFTWARE

66 | 67 | ``` 68 | 69 | git clone https://github.com/Elez-dev/ZksyncPaymaster.git 70 | 71 | cd ZksyncPaymaster-master 72 | 73 | pip3.10 install -r requirements.txt 74 | 75 | python3.10 main.py 76 | 77 | ``` 78 | 79 | --- 80 |

❤️ Any questions in our chat - https://t.me/pythondao

81 | 82 | -------------------------------------------------------------------------------- /abi/Token.txt: -------------------------------------------------------------------------------- 1 | [{"inputs":[],"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":true,"internalType":"address","name":"usr","type":"address"}],"name":"Deny","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Rely","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":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","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":"usr","type":"address"}],"name":"deny","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deploymentChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","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":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"rely","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":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] 2 | -------------------------------------------------------------------------------- /abi/classic_pool_factory_syncswap.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_master", 7 | "type": "address" 8 | } 9 | ], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "inputs": [], 15 | "name": "InvalidTokens", 16 | "type": "error" 17 | }, 18 | { 19 | "anonymous": false, 20 | "inputs": [ 21 | { 22 | "indexed": true, 23 | "internalType": "address", 24 | "name": "token0", 25 | "type": "address" 26 | }, 27 | { 28 | "indexed": true, 29 | "internalType": "address", 30 | "name": "token1", 31 | "type": "address" 32 | }, 33 | { 34 | "indexed": false, 35 | "internalType": "address", 36 | "name": "pool", 37 | "type": "address" 38 | } 39 | ], 40 | "name": "PoolCreated", 41 | "type": "event" 42 | }, 43 | { 44 | "inputs": [ 45 | { 46 | "internalType": "bytes", 47 | "name": "data", 48 | "type": "bytes" 49 | } 50 | ], 51 | "name": "createPool", 52 | "outputs": [ 53 | { 54 | "internalType": "address", 55 | "name": "pool", 56 | "type": "address" 57 | } 58 | ], 59 | "stateMutability": "nonpayable", 60 | "type": "function" 61 | }, 62 | { 63 | "inputs": [], 64 | "name": "getDeployData", 65 | "outputs": [ 66 | { 67 | "internalType": "bytes", 68 | "name": "deployData", 69 | "type": "bytes" 70 | } 71 | ], 72 | "stateMutability": "view", 73 | "type": "function" 74 | }, 75 | { 76 | "inputs": [ 77 | { 78 | "internalType": "address", 79 | "name": "", 80 | "type": "address" 81 | }, 82 | { 83 | "internalType": "address", 84 | "name": "", 85 | "type": "address" 86 | } 87 | ], 88 | "name": "getPool", 89 | "outputs": [ 90 | { 91 | "internalType": "address", 92 | "name": "", 93 | "type": "address" 94 | } 95 | ], 96 | "stateMutability": "view", 97 | "type": "function" 98 | }, 99 | { 100 | "inputs": [ 101 | { 102 | "internalType": "address", 103 | "name": "pool", 104 | "type": "address" 105 | }, 106 | { 107 | "internalType": "address", 108 | "name": "sender", 109 | "type": "address" 110 | }, 111 | { 112 | "internalType": "address", 113 | "name": "tokenIn", 114 | "type": "address" 115 | }, 116 | { 117 | "internalType": "address", 118 | "name": "tokenOut", 119 | "type": "address" 120 | }, 121 | { 122 | "internalType": "bytes", 123 | "name": "data", 124 | "type": "bytes" 125 | } 126 | ], 127 | "name": "getSwapFee", 128 | "outputs": [ 129 | { 130 | "internalType": "uint24", 131 | "name": "swapFee", 132 | "type": "uint24" 133 | } 134 | ], 135 | "stateMutability": "view", 136 | "type": "function" 137 | }, 138 | { 139 | "inputs": [], 140 | "name": "master", 141 | "outputs": [ 142 | { 143 | "internalType": "address", 144 | "name": "", 145 | "type": "address" 146 | } 147 | ], 148 | "stateMutability": "view", 149 | "type": "function" 150 | } 151 | ] -------------------------------------------------------------------------------- /abi/classic_pool_syncswap.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "Expired", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [], 14 | "name": "InsufficientLiquidityMinted", 15 | "type": "error" 16 | }, 17 | { 18 | "inputs": [], 19 | "name": "InvalidSignature", 20 | "type": "error" 21 | }, 22 | { 23 | "inputs": [], 24 | "name": "Overflow", 25 | "type": "error" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "owner", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "spender", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "amount", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Approval", 50 | "type": "event" 51 | }, 52 | { 53 | "anonymous": false, 54 | "inputs": [ 55 | { 56 | "indexed": true, 57 | "internalType": "address", 58 | "name": "sender", 59 | "type": "address" 60 | }, 61 | { 62 | "indexed": false, 63 | "internalType": "uint256", 64 | "name": "amount0", 65 | "type": "uint256" 66 | }, 67 | { 68 | "indexed": false, 69 | "internalType": "uint256", 70 | "name": "amount1", 71 | "type": "uint256" 72 | }, 73 | { 74 | "indexed": false, 75 | "internalType": "uint256", 76 | "name": "liquidity", 77 | "type": "uint256" 78 | }, 79 | { 80 | "indexed": true, 81 | "internalType": "address", 82 | "name": "to", 83 | "type": "address" 84 | } 85 | ], 86 | "name": "Burn", 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": "amount0", 102 | "type": "uint256" 103 | }, 104 | { 105 | "indexed": false, 106 | "internalType": "uint256", 107 | "name": "amount1", 108 | "type": "uint256" 109 | }, 110 | { 111 | "indexed": false, 112 | "internalType": "uint256", 113 | "name": "liquidity", 114 | "type": "uint256" 115 | }, 116 | { 117 | "indexed": true, 118 | "internalType": "address", 119 | "name": "to", 120 | "type": "address" 121 | } 122 | ], 123 | "name": "Mint", 124 | "type": "event" 125 | }, 126 | { 127 | "anonymous": false, 128 | "inputs": [ 129 | { 130 | "indexed": true, 131 | "internalType": "address", 132 | "name": "sender", 133 | "type": "address" 134 | }, 135 | { 136 | "indexed": false, 137 | "internalType": "uint256", 138 | "name": "amount0In", 139 | "type": "uint256" 140 | }, 141 | { 142 | "indexed": false, 143 | "internalType": "uint256", 144 | "name": "amount1In", 145 | "type": "uint256" 146 | }, 147 | { 148 | "indexed": false, 149 | "internalType": "uint256", 150 | "name": "amount0Out", 151 | "type": "uint256" 152 | }, 153 | { 154 | "indexed": false, 155 | "internalType": "uint256", 156 | "name": "amount1Out", 157 | "type": "uint256" 158 | }, 159 | { 160 | "indexed": true, 161 | "internalType": "address", 162 | "name": "to", 163 | "type": "address" 164 | } 165 | ], 166 | "name": "Swap", 167 | "type": "event" 168 | }, 169 | { 170 | "anonymous": false, 171 | "inputs": [ 172 | { 173 | "indexed": false, 174 | "internalType": "uint256", 175 | "name": "reserve0", 176 | "type": "uint256" 177 | }, 178 | { 179 | "indexed": false, 180 | "internalType": "uint256", 181 | "name": "reserve1", 182 | "type": "uint256" 183 | } 184 | ], 185 | "name": "Sync", 186 | "type": "event" 187 | }, 188 | { 189 | "anonymous": false, 190 | "inputs": [ 191 | { 192 | "indexed": true, 193 | "internalType": "address", 194 | "name": "from", 195 | "type": "address" 196 | }, 197 | { 198 | "indexed": true, 199 | "internalType": "address", 200 | "name": "to", 201 | "type": "address" 202 | }, 203 | { 204 | "indexed": false, 205 | "internalType": "uint256", 206 | "name": "amount", 207 | "type": "uint256" 208 | } 209 | ], 210 | "name": "Transfer", 211 | "type": "event" 212 | }, 213 | { 214 | "inputs": [], 215 | "name": "DOMAIN_SEPARATOR", 216 | "outputs": [ 217 | { 218 | "internalType": "bytes32", 219 | "name": "", 220 | "type": "bytes32" 221 | } 222 | ], 223 | "stateMutability": "view", 224 | "type": "function" 225 | }, 226 | { 227 | "inputs": [ 228 | { 229 | "internalType": "address", 230 | "name": "", 231 | "type": "address" 232 | }, 233 | { 234 | "internalType": "address", 235 | "name": "", 236 | "type": "address" 237 | } 238 | ], 239 | "name": "allowance", 240 | "outputs": [ 241 | { 242 | "internalType": "uint256", 243 | "name": "", 244 | "type": "uint256" 245 | } 246 | ], 247 | "stateMutability": "view", 248 | "type": "function" 249 | }, 250 | { 251 | "inputs": [ 252 | { 253 | "internalType": "address", 254 | "name": "_spender", 255 | "type": "address" 256 | }, 257 | { 258 | "internalType": "uint256", 259 | "name": "_amount", 260 | "type": "uint256" 261 | } 262 | ], 263 | "name": "approve", 264 | "outputs": [ 265 | { 266 | "internalType": "bool", 267 | "name": "", 268 | "type": "bool" 269 | } 270 | ], 271 | "stateMutability": "nonpayable", 272 | "type": "function" 273 | }, 274 | { 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 | "stateMutability": "view", 291 | "type": "function" 292 | }, 293 | { 294 | "inputs": [ 295 | { 296 | "internalType": "bytes", 297 | "name": "_data", 298 | "type": "bytes" 299 | }, 300 | { 301 | "internalType": "address", 302 | "name": "_sender", 303 | "type": "address" 304 | }, 305 | { 306 | "internalType": "address", 307 | "name": "_callback", 308 | "type": "address" 309 | }, 310 | { 311 | "internalType": "bytes", 312 | "name": "_callbackData", 313 | "type": "bytes" 314 | } 315 | ], 316 | "name": "burn", 317 | "outputs": [ 318 | { 319 | "components": [ 320 | { 321 | "internalType": "address", 322 | "name": "token", 323 | "type": "address" 324 | }, 325 | { 326 | "internalType": "uint256", 327 | "name": "amount", 328 | "type": "uint256" 329 | } 330 | ], 331 | "internalType": "struct IPool.TokenAmount[]", 332 | "name": "_amounts", 333 | "type": "tuple[]" 334 | } 335 | ], 336 | "stateMutability": "nonpayable", 337 | "type": "function" 338 | }, 339 | { 340 | "inputs": [ 341 | { 342 | "internalType": "bytes", 343 | "name": "_data", 344 | "type": "bytes" 345 | }, 346 | { 347 | "internalType": "address", 348 | "name": "_sender", 349 | "type": "address" 350 | }, 351 | { 352 | "internalType": "address", 353 | "name": "_callback", 354 | "type": "address" 355 | }, 356 | { 357 | "internalType": "bytes", 358 | "name": "_callbackData", 359 | "type": "bytes" 360 | } 361 | ], 362 | "name": "burnSingle", 363 | "outputs": [ 364 | { 365 | "components": [ 366 | { 367 | "internalType": "address", 368 | "name": "token", 369 | "type": "address" 370 | }, 371 | { 372 | "internalType": "uint256", 373 | "name": "amount", 374 | "type": "uint256" 375 | } 376 | ], 377 | "internalType": "struct IPool.TokenAmount", 378 | "name": "_tokenAmount", 379 | "type": "tuple" 380 | } 381 | ], 382 | "stateMutability": "nonpayable", 383 | "type": "function" 384 | }, 385 | { 386 | "inputs": [], 387 | "name": "decimals", 388 | "outputs": [ 389 | { 390 | "internalType": "uint8", 391 | "name": "", 392 | "type": "uint8" 393 | } 394 | ], 395 | "stateMutability": "view", 396 | "type": "function" 397 | }, 398 | { 399 | "inputs": [ 400 | { 401 | "internalType": "address", 402 | "name": "_tokenOut", 403 | "type": "address" 404 | }, 405 | { 406 | "internalType": "uint256", 407 | "name": "_amountOut", 408 | "type": "uint256" 409 | }, 410 | { 411 | "internalType": "address", 412 | "name": "_sender", 413 | "type": "address" 414 | } 415 | ], 416 | "name": "getAmountIn", 417 | "outputs": [ 418 | { 419 | "internalType": "uint256", 420 | "name": "_amountIn", 421 | "type": "uint256" 422 | } 423 | ], 424 | "stateMutability": "view", 425 | "type": "function" 426 | }, 427 | { 428 | "inputs": [ 429 | { 430 | "internalType": "address", 431 | "name": "_tokenIn", 432 | "type": "address" 433 | }, 434 | { 435 | "internalType": "uint256", 436 | "name": "_amountIn", 437 | "type": "uint256" 438 | }, 439 | { 440 | "internalType": "address", 441 | "name": "_sender", 442 | "type": "address" 443 | } 444 | ], 445 | "name": "getAmountOut", 446 | "outputs": [ 447 | { 448 | "internalType": "uint256", 449 | "name": "_amountOut", 450 | "type": "uint256" 451 | } 452 | ], 453 | "stateMutability": "view", 454 | "type": "function" 455 | }, 456 | { 457 | "inputs": [], 458 | "name": "getAssets", 459 | "outputs": [ 460 | { 461 | "internalType": "address[]", 462 | "name": "assets", 463 | "type": "address[]" 464 | } 465 | ], 466 | "stateMutability": "view", 467 | "type": "function" 468 | }, 469 | { 470 | "inputs": [], 471 | "name": "getProtocolFee", 472 | "outputs": [ 473 | { 474 | "internalType": "uint24", 475 | "name": "_protocolFee", 476 | "type": "uint24" 477 | } 478 | ], 479 | "stateMutability": "view", 480 | "type": "function" 481 | }, 482 | { 483 | "inputs": [], 484 | "name": "getReserves", 485 | "outputs": [ 486 | { 487 | "internalType": "uint256", 488 | "name": "_reserve0", 489 | "type": "uint256" 490 | }, 491 | { 492 | "internalType": "uint256", 493 | "name": "_reserve1", 494 | "type": "uint256" 495 | } 496 | ], 497 | "stateMutability": "view", 498 | "type": "function" 499 | }, 500 | { 501 | "inputs": [ 502 | { 503 | "internalType": "address", 504 | "name": "_sender", 505 | "type": "address" 506 | }, 507 | { 508 | "internalType": "address", 509 | "name": "_tokenIn", 510 | "type": "address" 511 | }, 512 | { 513 | "internalType": "address", 514 | "name": "_tokenOut", 515 | "type": "address" 516 | }, 517 | { 518 | "internalType": "bytes", 519 | "name": "data", 520 | "type": "bytes" 521 | } 522 | ], 523 | "name": "getSwapFee", 524 | "outputs": [ 525 | { 526 | "internalType": "uint24", 527 | "name": "_swapFee", 528 | "type": "uint24" 529 | } 530 | ], 531 | "stateMutability": "view", 532 | "type": "function" 533 | }, 534 | { 535 | "inputs": [], 536 | "name": "invariantLast", 537 | "outputs": [ 538 | { 539 | "internalType": "uint256", 540 | "name": "", 541 | "type": "uint256" 542 | } 543 | ], 544 | "stateMutability": "view", 545 | "type": "function" 546 | }, 547 | { 548 | "inputs": [], 549 | "name": "master", 550 | "outputs": [ 551 | { 552 | "internalType": "address", 553 | "name": "", 554 | "type": "address" 555 | } 556 | ], 557 | "stateMutability": "view", 558 | "type": "function" 559 | }, 560 | { 561 | "inputs": [ 562 | { 563 | "internalType": "bytes", 564 | "name": "_data", 565 | "type": "bytes" 566 | }, 567 | { 568 | "internalType": "address", 569 | "name": "_sender", 570 | "type": "address" 571 | }, 572 | { 573 | "internalType": "address", 574 | "name": "_callback", 575 | "type": "address" 576 | }, 577 | { 578 | "internalType": "bytes", 579 | "name": "_callbackData", 580 | "type": "bytes" 581 | } 582 | ], 583 | "name": "mint", 584 | "outputs": [ 585 | { 586 | "internalType": "uint256", 587 | "name": "", 588 | "type": "uint256" 589 | } 590 | ], 591 | "stateMutability": "nonpayable", 592 | "type": "function" 593 | }, 594 | { 595 | "inputs": [], 596 | "name": "name", 597 | "outputs": [ 598 | { 599 | "internalType": "string", 600 | "name": "", 601 | "type": "string" 602 | } 603 | ], 604 | "stateMutability": "view", 605 | "type": "function" 606 | }, 607 | { 608 | "inputs": [ 609 | { 610 | "internalType": "address", 611 | "name": "", 612 | "type": "address" 613 | } 614 | ], 615 | "name": "nonces", 616 | "outputs": [ 617 | { 618 | "internalType": "uint256", 619 | "name": "", 620 | "type": "uint256" 621 | } 622 | ], 623 | "stateMutability": "view", 624 | "type": "function" 625 | }, 626 | { 627 | "inputs": [ 628 | { 629 | "internalType": "address", 630 | "name": "_owner", 631 | "type": "address" 632 | }, 633 | { 634 | "internalType": "address", 635 | "name": "_spender", 636 | "type": "address" 637 | }, 638 | { 639 | "internalType": "uint256", 640 | "name": "_amount", 641 | "type": "uint256" 642 | }, 643 | { 644 | "internalType": "uint256", 645 | "name": "_deadline", 646 | "type": "uint256" 647 | }, 648 | { 649 | "internalType": "uint8", 650 | "name": "_v", 651 | "type": "uint8" 652 | }, 653 | { 654 | "internalType": "bytes32", 655 | "name": "_r", 656 | "type": "bytes32" 657 | }, 658 | { 659 | "internalType": "bytes32", 660 | "name": "_s", 661 | "type": "bytes32" 662 | } 663 | ], 664 | "name": "permit", 665 | "outputs": [], 666 | "stateMutability": "nonpayable", 667 | "type": "function" 668 | }, 669 | { 670 | "inputs": [ 671 | { 672 | "internalType": "address", 673 | "name": "_owner", 674 | "type": "address" 675 | }, 676 | { 677 | "internalType": "address", 678 | "name": "_spender", 679 | "type": "address" 680 | }, 681 | { 682 | "internalType": "uint256", 683 | "name": "_amount", 684 | "type": "uint256" 685 | }, 686 | { 687 | "internalType": "uint256", 688 | "name": "_deadline", 689 | "type": "uint256" 690 | }, 691 | { 692 | "internalType": "bytes", 693 | "name": "_signature", 694 | "type": "bytes" 695 | } 696 | ], 697 | "name": "permit2", 698 | "outputs": [], 699 | "stateMutability": "nonpayable", 700 | "type": "function" 701 | }, 702 | { 703 | "inputs": [], 704 | "name": "poolType", 705 | "outputs": [ 706 | { 707 | "internalType": "uint16", 708 | "name": "", 709 | "type": "uint16" 710 | } 711 | ], 712 | "stateMutability": "view", 713 | "type": "function" 714 | }, 715 | { 716 | "inputs": [], 717 | "name": "reserve0", 718 | "outputs": [ 719 | { 720 | "internalType": "uint256", 721 | "name": "", 722 | "type": "uint256" 723 | } 724 | ], 725 | "stateMutability": "view", 726 | "type": "function" 727 | }, 728 | { 729 | "inputs": [], 730 | "name": "reserve1", 731 | "outputs": [ 732 | { 733 | "internalType": "uint256", 734 | "name": "", 735 | "type": "uint256" 736 | } 737 | ], 738 | "stateMutability": "view", 739 | "type": "function" 740 | }, 741 | { 742 | "inputs": [ 743 | { 744 | "internalType": "bytes4", 745 | "name": "interfaceID", 746 | "type": "bytes4" 747 | } 748 | ], 749 | "name": "supportsInterface", 750 | "outputs": [ 751 | { 752 | "internalType": "bool", 753 | "name": "", 754 | "type": "bool" 755 | } 756 | ], 757 | "stateMutability": "pure", 758 | "type": "function" 759 | }, 760 | { 761 | "inputs": [ 762 | { 763 | "internalType": "bytes", 764 | "name": "_data", 765 | "type": "bytes" 766 | }, 767 | { 768 | "internalType": "address", 769 | "name": "_sender", 770 | "type": "address" 771 | }, 772 | { 773 | "internalType": "address", 774 | "name": "_callback", 775 | "type": "address" 776 | }, 777 | { 778 | "internalType": "bytes", 779 | "name": "_callbackData", 780 | "type": "bytes" 781 | } 782 | ], 783 | "name": "swap", 784 | "outputs": [ 785 | { 786 | "components": [ 787 | { 788 | "internalType": "address", 789 | "name": "token", 790 | "type": "address" 791 | }, 792 | { 793 | "internalType": "uint256", 794 | "name": "amount", 795 | "type": "uint256" 796 | } 797 | ], 798 | "internalType": "struct IPool.TokenAmount", 799 | "name": "_tokenAmount", 800 | "type": "tuple" 801 | } 802 | ], 803 | "stateMutability": "nonpayable", 804 | "type": "function" 805 | }, 806 | { 807 | "inputs": [], 808 | "name": "symbol", 809 | "outputs": [ 810 | { 811 | "internalType": "string", 812 | "name": "", 813 | "type": "string" 814 | } 815 | ], 816 | "stateMutability": "view", 817 | "type": "function" 818 | }, 819 | { 820 | "inputs": [], 821 | "name": "token0", 822 | "outputs": [ 823 | { 824 | "internalType": "address", 825 | "name": "", 826 | "type": "address" 827 | } 828 | ], 829 | "stateMutability": "view", 830 | "type": "function" 831 | }, 832 | { 833 | "inputs": [], 834 | "name": "token1", 835 | "outputs": [ 836 | { 837 | "internalType": "address", 838 | "name": "", 839 | "type": "address" 840 | } 841 | ], 842 | "stateMutability": "view", 843 | "type": "function" 844 | }, 845 | { 846 | "inputs": [], 847 | "name": "totalSupply", 848 | "outputs": [ 849 | { 850 | "internalType": "uint256", 851 | "name": "", 852 | "type": "uint256" 853 | } 854 | ], 855 | "stateMutability": "view", 856 | "type": "function" 857 | }, 858 | { 859 | "inputs": [ 860 | { 861 | "internalType": "address", 862 | "name": "_to", 863 | "type": "address" 864 | }, 865 | { 866 | "internalType": "uint256", 867 | "name": "_amount", 868 | "type": "uint256" 869 | } 870 | ], 871 | "name": "transfer", 872 | "outputs": [ 873 | { 874 | "internalType": "bool", 875 | "name": "", 876 | "type": "bool" 877 | } 878 | ], 879 | "stateMutability": "nonpayable", 880 | "type": "function" 881 | }, 882 | { 883 | "inputs": [ 884 | { 885 | "internalType": "address", 886 | "name": "_from", 887 | "type": "address" 888 | }, 889 | { 890 | "internalType": "address", 891 | "name": "_to", 892 | "type": "address" 893 | }, 894 | { 895 | "internalType": "uint256", 896 | "name": "_amount", 897 | "type": "uint256" 898 | } 899 | ], 900 | "name": "transferFrom", 901 | "outputs": [ 902 | { 903 | "internalType": "bool", 904 | "name": "", 905 | "type": "bool" 906 | } 907 | ], 908 | "stateMutability": "nonpayable", 909 | "type": "function" 910 | }, 911 | { 912 | "inputs": [], 913 | "name": "vault", 914 | "outputs": [ 915 | { 916 | "internalType": "address", 917 | "name": "", 918 | "type": "address" 919 | } 920 | ], 921 | "stateMutability": "view", 922 | "type": "function" 923 | } 924 | ] -------------------------------------------------------------------------------- /abi/mute.txt: -------------------------------------------------------------------------------- 1 | [ { "inputs": [ { "internalType": "address", "name": "_factory", "type": "address" }, { "internalType": "address", "name": "_weth", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "stateMutability": "payable", "type": "fallback" }, { "inputs": [], "name": "WETH", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" }, { "internalType": "uint256", "name": "amountADesired", "type": "uint256" }, { "internalType": "uint256", "name": "amountBDesired", "type": "uint256" }, { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "uint256", "name": "feeType", "type": "uint256" }, { "internalType": "bool", "name": "stable", "type": "bool" } ], "name": "addLiquidity", "outputs": [ { "internalType": "uint256", "name": "amountA", "type": "uint256" }, { "internalType": "uint256", "name": "amountB", "type": "uint256" }, { "internalType": "uint256", "name": "liquidity", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "amountTokenDesired", "type": "uint256" }, { "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" }, { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "uint256", "name": "feeType", "type": "uint256" }, { "internalType": "bool", "name": "stable", "type": "bool" } ], "name": "addLiquidityETH", "outputs": [ { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, { "internalType": "uint256", "name": "amountETH", "type": "uint256" }, { "internalType": "uint256", "name": "liquidity", "type": "uint256" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [], "name": "factory", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, { "internalType": "address", "name": "tokenIn", "type": "address" }, { "internalType": "address", "name": "tokenOut", "type": "address" } ], "name": "getAmountOut", "outputs": [ { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, { "internalType": "bool", "name": "stable", "type": "bool" }, { "internalType": "uint256", "name": "fee", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, { "internalType": "address[]", "name": "path", "type": "address[]" }, { "internalType": "bool[]", "name": "stable", "type": "bool[]" } ], "name": "getAmountsOut", "outputs": [ { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, { "internalType": "address[]", "name": "path", "type": "address[]" } ], "name": "getAmountsOutExpanded", "outputs": [ { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }, { "internalType": "bool[]", "name": "stable", "type": "bool[]" }, { "internalType": "uint256[]", "name": "fees", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "path", "type": "address[]" }, { "internalType": "bool", "name": "stable", "type": "bool" } ], "name": "getPairInfo", "outputs": [ { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" }, { "internalType": "address", "name": "pair", "type": "address" }, { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, { "internalType": "uint256", "name": "reserveB", "type": "uint256" }, { "internalType": "uint256", "name": "fee", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" }, { "internalType": "bool", "name": "stable", "type": "bool" } ], "name": "getReserves", "outputs": [ { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, { "internalType": "uint256", "name": "reserveB", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" }, { "internalType": "bool", "name": "stable", "type": "bool" } ], "name": "pairFor", "outputs": [ { "internalType": "address", "name": "pair", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountA", "type": "uint256" }, { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, { "internalType": "uint256", "name": "reserveB", "type": "uint256" } ], "name": "quote", "outputs": [ { "internalType": "uint256", "name": "amountB", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" }, { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool", "name": "stable", "type": "bool" } ], "name": "removeLiquidity", "outputs": [ { "internalType": "uint256", "name": "amountA", "type": "uint256" }, { "internalType": "uint256", "name": "amountB", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, { "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" }, { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool", "name": "stable", "type": "bool" } ], "name": "removeLiquidityETH", "outputs": [ { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, { "internalType": "uint256", "name": "amountETH", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, { "internalType": "uint256", "name": "amountTokenMin", "type": "uint256" }, { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool", "name": "stable", "type": "bool" } ], "name": "removeLiquidityETHSupportingFeeOnTransferTokens", "outputs": [ { "internalType": "uint256", "name": "amountETH", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "tokenA", "type": "address" }, { "internalType": "address", "name": "tokenB", "type": "address" } ], "name": "sortTokens", "outputs": [ { "internalType": "address", "name": "token0", "type": "address" }, { "internalType": "address", "name": "token1", "type": "address" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, { "internalType": "address[]", "name": "path", "type": "address[]" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool[]", "name": "stable", "type": "bool[]" } ], "name": "swapExactETHForTokens", "outputs": [ { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, { "internalType": "address[]", "name": "path", "type": "address[]" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool[]", "name": "stable", "type": "bool[]" } ], "name": "swapExactETHForTokensSupportingFeeOnTransferTokens", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, { "internalType": "address[]", "name": "path", "type": "address[]" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool[]", "name": "stable", "type": "bool[]" } ], "name": "swapExactTokensForETH", "outputs": [ { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, { "internalType": "address[]", "name": "path", "type": "address[]" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool[]", "name": "stable", "type": "bool[]" } ], "name": "swapExactTokensForETHSupportingFeeOnTransferTokens", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, { "internalType": "address[]", "name": "path", "type": "address[]" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool[]", "name": "stable", "type": "bool[]" } ], "name": "swapExactTokensForTokens", "outputs": [ { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, { "internalType": "address[]", "name": "path", "type": "address[]" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bool[]", "name": "stable", "type": "bool[]" } ], "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens", "outputs": [], "stateMutability": "nonpayable", "type": "function" }] -------------------------------------------------------------------------------- /abi/router_syncswap.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "components": [ 6 | { 7 | "components": [ 8 | { 9 | "internalType": "address", 10 | "name": "pool", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "bytes", 15 | "name": "data", 16 | "type": "bytes" 17 | }, 18 | { 19 | "internalType": "address", 20 | "name": "callback", 21 | "type": "address" 22 | }, 23 | { 24 | "internalType": "bytes", 25 | "name": "callbackData", 26 | "type": "bytes" 27 | }, 28 | { 29 | "internalType": "bool", 30 | "name": "useVault", 31 | "type": "bool" 32 | } 33 | ], 34 | "internalType": "struct IRouter.SwapStep[]", 35 | "name": "steps", 36 | "type": "tuple[]" 37 | }, 38 | { 39 | "internalType": "address", 40 | "name": "tokenIn", 41 | "type": "address" 42 | }, 43 | { 44 | "internalType": "uint256", 45 | "name": "amountIn", 46 | "type": "uint256" 47 | } 48 | ], 49 | "internalType": "struct IRouter.SwapPath[]", 50 | "name": "paths", 51 | "type": "tuple[]" 52 | }, 53 | { 54 | "internalType": "uint256", 55 | "name": "amountOutMin", 56 | "type": "uint256" 57 | }, 58 | { 59 | "internalType": "uint256", 60 | "name": "deadline", 61 | "type": "uint256" 62 | } 63 | ], 64 | "name": "swap", 65 | "outputs": [ 66 | { 67 | "components": [ 68 | { 69 | "internalType": "address", 70 | "name": "token", 71 | "type": "address" 72 | }, 73 | { 74 | "internalType": "uint256", 75 | "name": "amount", 76 | "type": "uint256" 77 | } 78 | ], 79 | "internalType": "struct IPool.TokenAmount", 80 | "name": "amountOut", 81 | "type": "tuple" 82 | } 83 | ], 84 | "stateMutability": "payable", 85 | "type": "function" 86 | } 87 | ] 88 | -------------------------------------------------------------------------------- /abi/velocore_multicall.txt: -------------------------------------------------------------------------------- 1 | [{"inputs": [{"components": [{"internalType": "address", "name": "target", "type": "address"}, {"internalType": "bytes", "name": "callData", "type": "bytes"}], "internalType": "struct Multicall3.Call[]", "name": "calls", "type": "tuple[]"}], "name": "aggregate", "outputs": [{"internalType": "uint256", "name": "blockNumber", "type": "uint256"}, {"internalType": "bytes[]", "name": "returnData", "type": "bytes[]"}], "stateMutability": "payable", "type": "function"}, {"inputs": [{"components": [{"internalType": "address", "name": "target", "type": "address"}, {"internalType": "bool", "name": "allowFailure", "type": "bool"}, {"internalType": "bytes", "name": "callData", "type": "bytes"}], "internalType": "struct Multicall3.Call3[]", "name": "calls", "type": "tuple[]"}], "name": "aggregate3", "outputs": [{"components": [{"internalType": "bool", "name": "success", "type": "bool"}, {"internalType": "bytes", "name": "returnData", "type": "bytes"}], "internalType": "struct Multicall3.Result[]", "name": "returnData", "type": "tuple[]"}], "stateMutability": "payable", "type": "function"}, {"inputs": [{"components": [{"internalType": "address", "name": "target", "type": "address"}, {"internalType": "bool", "name": "allowFailure", "type": "bool"}, {"internalType": "uint256", "name": "value", "type": "uint256"}, {"internalType": "bytes", "name": "callData", "type": "bytes"}], "internalType": "struct Multicall3.Call3Value[]", "name": "calls", "type": "tuple[]"}], "name": "aggregate3Value", "outputs": [{"components": [{"internalType": "bool", "name": "success", "type": "bool"}, {"internalType": "bytes", "name": "returnData", "type": "bytes"}], "internalType": "struct Multicall3.Result[]", "name": "returnData", "type": "tuple[]"}], "stateMutability": "payable", "type": "function"}, {"inputs": [{"components": [{"internalType": "address", "name": "target", "type": "address"}, {"internalType": "bytes", "name": "callData", "type": "bytes"}], "internalType": "struct Multicall3.Call[]", "name": "calls", "type": "tuple[]"}], "name": "blockAndAggregate", "outputs": [{"internalType": "uint256", "name": "blockNumber", "type": "uint256"}, {"internalType": "bytes32", "name": "blockHash", "type": "bytes32"}, {"components": [{"internalType": "bool", "name": "success", "type": "bool"}, {"internalType": "bytes", "name": "returnData", "type": "bytes"}], "internalType": "struct Multicall3.Result[]", "name": "returnData", "type": "tuple[]"}], "stateMutability": "payable", "type": "function"}, {"inputs": [], "name": "getBasefee", "outputs": [{"internalType": "uint256", "name": "basefee", "type": "uint256"}], "stateMutability": "view", "type": "function"}, {"inputs": [{"internalType": "uint256", "name": "blockNumber", "type": "uint256"}], "name": "getBlockHash", "outputs": [{"internalType": "bytes32", "name": "blockHash", "type": "bytes32"}], "stateMutability": "view", "type": "function"}, {"inputs": [], "name": "getBlockNumber", "outputs": [{"internalType": "uint256", "name": "blockNumber", "type": "uint256"}], "stateMutability": "view", "type": "function"}, {"inputs": [], "name": "getChainId", "outputs": [{"internalType": "uint256", "name": "chainid", "type": "uint256"}], "stateMutability": "view", "type": "function"}, {"inputs": [], "name": "getCurrentBlockCoinbase", "outputs": [{"internalType": "address", "name": "coinbase", "type": "address"}], "stateMutability": "view", "type": "function"}, {"inputs": [], "name": "getCurrentBlockDifficulty", "outputs": [{"internalType": "uint256", "name": "difficulty", "type": "uint256"}], "stateMutability": "view", "type": "function"}, {"inputs": [], "name": "getCurrentBlockGasLimit", "outputs": [{"internalType": "uint256", "name": "gaslimit", "type": "uint256"}], "stateMutability": "view", "type": "function"}, {"inputs": [], "name": "getCurrentBlockTimestamp", "outputs": [{"internalType": "uint256", "name": "timestamp", "type": "uint256"}], "stateMutability": "view", "type": "function"}, {"inputs": [{"internalType": "address", "name": "addr", "type": "address"}], "name": "getEthBalance", "outputs": [{"internalType": "uint256", "name": "balance", "type": "uint256"}], "stateMutability": "view", "type": "function"}, {"inputs": [], "name": "getLastBlockHash", "outputs": [{"internalType": "bytes32", "name": "blockHash", "type": "bytes32"}], "stateMutability": "view", "type": "function"}, {"inputs": [{"internalType": "bool", "name": "requireSuccess", "type": "bool"}, {"components": [{"internalType": "address", "name": "target", "type": "address"}, {"internalType": "bytes", "name": "callData", "type": "bytes"}], "internalType": "struct Multicall3.Call[]", "name": "calls", "type": "tuple[]"}], "name": "tryAggregate", "outputs": [{"components": [{"internalType": "bool", "name": "success", "type": "bool"}, {"internalType": "bytes", "name": "returnData", "type": "bytes"}], "internalType": "struct Multicall3.Result[]", "name": "returnData", "type": "tuple[]"}], "stateMutability": "payable", "type": "function"}, {"inputs": [{"internalType": "bool", "name": "requireSuccess", "type": "bool"}, {"components": [{"internalType": "address", "name": "target", "type": "address"}, {"internalType": "bytes", "name": "callData", "type": "bytes"}], "internalType": "struct Multicall3.Call[]", "name": "calls", "type": "tuple[]"}], "name": "tryBlockAndAggregate", "outputs": [{"internalType": "uint256", "name": "blockNumber", "type": "uint256"}, {"internalType": "bytes32", "name": "blockHash", "type": "bytes32"}, {"components": [{"internalType": "bool", "name": "success", "type": "bool"}, {"internalType": "bytes", "name": "returnData", "type": "bytes"}], "internalType": "struct Multicall3.Result[]", "name": "returnData", "type": "tuple[]"}], "stateMutability": "payable", "type": "function"}] -------------------------------------------------------------------------------- /abi/velocore_router.txt: -------------------------------------------------------------------------------- 1 | [{"inputs": [{"internalType": "contract IVC", "name": "vc_", "type": "address"}, {"internalType": "contract IWETH", "name": "weth_", "type": "address"}, {"internalType": "Token", "name": "ballot_", "type": "bytes32"}], "stateMutability": "nonpayable", "type": "constructor"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "contract IGauge", "name": "gauge", "type": "address"}, {"indexed": true, "internalType": "contract IBribe", "name": "bribe", "type": "address"}], "name": "BribeAttached", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "contract IGauge", "name": "gauge", "type": "address"}, {"indexed": true, "internalType": "contract IBribe", "name": "bribe", "type": "address"}], "name": "BribeKilled", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "contract IConverter", "name": "pool", "type": "address"}, {"indexed": true, "internalType": "address", "name": "user", "type": "address"}, {"indexed": false, "internalType": "Token[]", "name": "tokenRef", "type": "bytes32[]"}, {"indexed": false, "internalType": "int128[]", "name": "delta", "type": "int128[]"}], "name": "Convert", "type": "event"}, {"anonymous": false, "inputs": [{"components": [{"internalType": "address", "name": "facetAddress", "type": "address"}, {"internalType": "enum VaultStorage.FacetCutAction", "name": "action", "type": "uint8"}, {"internalType": "bytes4[]", "name": "functionSelectors", "type": "bytes4[]"}], "indexed": false, "internalType": "struct VaultStorage.FacetCut[]", "name": "_diamondCut", "type": "tuple[]"}, {"indexed": false, "internalType": "address", "name": "_init", "type": "address"}, {"indexed": false, "internalType": "bytes", "name": "_calldata", "type": "bytes"}], "name": "DiamondCut", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "contract IGauge", "name": "pool", "type": "address"}, {"indexed": true, "internalType": "address", "name": "user", "type": "address"}, {"indexed": false, "internalType": "Token[]", "name": "tokenRef", "type": "bytes32[]"}, {"indexed": false, "internalType": "int128[]", "name": "delta", "type": "int128[]"}], "name": "Gauge", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "contract IGauge", "name": "gauge", "type": "address"}, {"indexed": false, "internalType": "bool", "name": "killed", "type": "bool"}], "name": "GaugeKilled", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "contract ISwap", "name": "pool", "type": "address"}, {"indexed": true, "internalType": "address", "name": "user", "type": "address"}, {"indexed": false, "internalType": "Token[]", "name": "tokenRef", "type": "bytes32[]"}, {"indexed": false, "internalType": "int128[]", "name": "delta", "type": "int128[]"}], "name": "Swap", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "address", "name": "to", "type": "address"}, {"indexed": true, "internalType": "address", "name": "from", "type": "address"}, {"indexed": false, "internalType": "Token[]", "name": "tokenRef", "type": "bytes32[]"}, {"indexed": false, "internalType": "int128[]", "name": "delta", "type": "int128[]"}], "name": "UserBalance", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "contract IGauge", "name": "pool", "type": "address"}, {"indexed": true, "internalType": "address", "name": "user", "type": "address"}, {"indexed": false, "internalType": "int256", "name": "voteDelta", "type": "int256"}], "name": "Vote", "type": "event"}, {"inputs": [{"internalType": "Token[]", "name": "tokens", "type": "bytes32[]"}, {"internalType": "uint256[]", "name": "balancesBefore", "type": "uint256[]"}], "name": "balanceDelta", "outputs": [{"internalType": "int128[]", "name": "delta", "type": "int128[]"}], "stateMutability": "nonpayable", "type": "function"}, {"inputs": [{"internalType": "Token[]", "name": "tokenRef", "type": "bytes32[]"}, {"internalType": "int128[]", "name": "deposit", "type": "int128[]"}, {"components": [{"internalType": "bytes32", "name": "poolId", "type": "bytes32"}, {"internalType": "bytes32[]", "name": "tokenInformations", "type": "bytes32[]"}, {"internalType": "bytes", "name": "data", "type": "bytes"}], "internalType": "struct VelocoreOperation[]", "name": "ops", "type": "tuple[]"}], "name": "execute", "outputs": [{"internalType": "int128[]", "name": "", "type": "int128[]"}], "stateMutability": "payable", "type": "function"}, {"inputs": [{"internalType": "uint256", "name": "bribeIndex", "type": "uint256"}, {"internalType": "Token[]", "name": "tokenRef", "type": "bytes32[]"}, {"internalType": "int128[]", "name": "cumDelta", "type": "int128[]"}, {"internalType": "contract IGauge", "name": "gauge", "type": "address"}, {"internalType": "uint256", "name": "elapsed", "type": "uint256"}, {"internalType": "address", "name": "user", "type": "address"}], "name": "extort", "outputs": [], "stateMutability": "payable", "type": "function"}, {"inputs": [], "name": "initializeFacet", "outputs": [], "stateMutability": "nonpayable", "type": "function"}, {"inputs": [{"internalType": "address", "name": "user", "type": "address"}, {"internalType": "Token[]", "name": "tokenRef", "type": "bytes32[]"}, {"internalType": "int128[]", "name": "deposit", "type": "int128[]"}, {"components": [{"internalType": "bytes32", "name": "poolId", "type": "bytes32"}, {"internalType": "bytes32[]", "name": "tokenInformations", "type": "bytes32[]"}, {"internalType": "bytes", "name": "data", "type": "bytes"}], "internalType": "struct VelocoreOperation[]", "name": "ops", "type": "tuple[]"}], "name": "query", "outputs": [{"internalType": "int128[]", "name": "", "type": "int128[]"}], "stateMutability": "nonpayable", "type": "function"}] -------------------------------------------------------------------------------- /contract_abi/ContractDeployer.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "anonymous": false, 5 | "inputs": [ 6 | { 7 | "indexed": true, 8 | "internalType": "address", 9 | "name": "accountAddress", 10 | "type": "address" 11 | }, 12 | { 13 | "indexed": false, 14 | "internalType": "enum IContractDeployer.AccountNonceOrdering", 15 | "name": "nonceOrdering", 16 | "type": "uint8" 17 | } 18 | ], 19 | "name": "AccountNonceOrderingUpdated", 20 | "type": "event" 21 | }, 22 | { 23 | "anonymous": false, 24 | "inputs": [ 25 | { 26 | "indexed": true, 27 | "internalType": "address", 28 | "name": "accountAddress", 29 | "type": "address" 30 | }, 31 | { 32 | "indexed": false, 33 | "internalType": "enum IContractDeployer.AccountAbstractionVersion", 34 | "name": "aaVersion", 35 | "type": "uint8" 36 | } 37 | ], 38 | "name": "AccountVersionUpdated", 39 | "type": "event" 40 | }, 41 | { 42 | "anonymous": false, 43 | "inputs": [ 44 | { 45 | "indexed": true, 46 | "internalType": "address", 47 | "name": "deployerAddress", 48 | "type": "address" 49 | }, 50 | { 51 | "indexed": true, 52 | "internalType": "bytes32", 53 | "name": "bytecodeHash", 54 | "type": "bytes32" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "contractAddress", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "ContractDeployed", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "bytes32", 70 | "name": "_salt", 71 | "type": "bytes32" 72 | }, 73 | { 74 | "internalType": "bytes32", 75 | "name": "_bytecodeHash", 76 | "type": "bytes32" 77 | }, 78 | { 79 | "internalType": "bytes", 80 | "name": "_input", 81 | "type": "bytes" 82 | } 83 | ], 84 | "name": "create", 85 | "outputs": [ 86 | { 87 | "internalType": "address", 88 | "name": "", 89 | "type": "address" 90 | } 91 | ], 92 | "stateMutability": "payable", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [ 97 | { 98 | "internalType": "bytes32", 99 | "name": "_salt", 100 | "type": "bytes32" 101 | }, 102 | { 103 | "internalType": "bytes32", 104 | "name": "_bytecodeHash", 105 | "type": "bytes32" 106 | }, 107 | { 108 | "internalType": "bytes", 109 | "name": "_input", 110 | "type": "bytes" 111 | } 112 | ], 113 | "name": "create2", 114 | "outputs": [ 115 | { 116 | "internalType": "address", 117 | "name": "", 118 | "type": "address" 119 | } 120 | ], 121 | "stateMutability": "payable", 122 | "type": "function" 123 | }, 124 | { 125 | "inputs": [ 126 | { 127 | "internalType": "bytes32", 128 | "name": "_salt", 129 | "type": "bytes32" 130 | }, 131 | { 132 | "internalType": "bytes32", 133 | "name": "_bytecodeHash", 134 | "type": "bytes32" 135 | }, 136 | { 137 | "internalType": "bytes", 138 | "name": "_input", 139 | "type": "bytes" 140 | }, 141 | { 142 | "internalType": "enum IContractDeployer.AccountAbstractionVersion", 143 | "name": "_aaVersion", 144 | "type": "uint8" 145 | } 146 | ], 147 | "name": "create2Account", 148 | "outputs": [ 149 | { 150 | "internalType": "address", 151 | "name": "", 152 | "type": "address" 153 | } 154 | ], 155 | "stateMutability": "payable", 156 | "type": "function" 157 | }, 158 | { 159 | "inputs": [ 160 | { 161 | "internalType": "bytes32", 162 | "name": "", 163 | "type": "bytes32" 164 | }, 165 | { 166 | "internalType": "bytes32", 167 | "name": "_bytecodeHash", 168 | "type": "bytes32" 169 | }, 170 | { 171 | "internalType": "bytes", 172 | "name": "_input", 173 | "type": "bytes" 174 | }, 175 | { 176 | "internalType": "enum IContractDeployer.AccountAbstractionVersion", 177 | "name": "_aaVersion", 178 | "type": "uint8" 179 | } 180 | ], 181 | "name": "createAccount", 182 | "outputs": [ 183 | { 184 | "internalType": "address", 185 | "name": "", 186 | "type": "address" 187 | } 188 | ], 189 | "stateMutability": "payable", 190 | "type": "function" 191 | }, 192 | { 193 | "inputs": [ 194 | { 195 | "internalType": "address", 196 | "name": "_address", 197 | "type": "address" 198 | } 199 | ], 200 | "name": "extendedAccountVersion", 201 | "outputs": [ 202 | { 203 | "internalType": "enum IContractDeployer.AccountAbstractionVersion", 204 | "name": "", 205 | "type": "uint8" 206 | } 207 | ], 208 | "stateMutability": "view", 209 | "type": "function" 210 | }, 211 | { 212 | "inputs": [ 213 | { 214 | "internalType": "bytes32", 215 | "name": "_keccak256BytecodeHash", 216 | "type": "bytes32" 217 | } 218 | ], 219 | "name": "forceDeployKeccak256", 220 | "outputs": [], 221 | "stateMutability": "payable", 222 | "type": "function" 223 | }, 224 | { 225 | "inputs": [ 226 | { 227 | "components": [ 228 | { 229 | "internalType": "bytes32", 230 | "name": "bytecodeHash", 231 | "type": "bytes32" 232 | }, 233 | { 234 | "internalType": "address", 235 | "name": "newAddress", 236 | "type": "address" 237 | }, 238 | { 239 | "internalType": "bool", 240 | "name": "callConstructor", 241 | "type": "bool" 242 | }, 243 | { 244 | "internalType": "uint256", 245 | "name": "value", 246 | "type": "uint256" 247 | }, 248 | { 249 | "internalType": "bytes", 250 | "name": "input", 251 | "type": "bytes" 252 | } 253 | ], 254 | "internalType": "struct ContractDeployer.ForceDeployment", 255 | "name": "_deployment", 256 | "type": "tuple" 257 | }, 258 | { 259 | "internalType": "address", 260 | "name": "_sender", 261 | "type": "address" 262 | } 263 | ], 264 | "name": "forceDeployOnAddress", 265 | "outputs": [], 266 | "stateMutability": "payable", 267 | "type": "function" 268 | }, 269 | { 270 | "inputs": [ 271 | { 272 | "components": [ 273 | { 274 | "internalType": "bytes32", 275 | "name": "bytecodeHash", 276 | "type": "bytes32" 277 | }, 278 | { 279 | "internalType": "address", 280 | "name": "newAddress", 281 | "type": "address" 282 | }, 283 | { 284 | "internalType": "bool", 285 | "name": "callConstructor", 286 | "type": "bool" 287 | }, 288 | { 289 | "internalType": "uint256", 290 | "name": "value", 291 | "type": "uint256" 292 | }, 293 | { 294 | "internalType": "bytes", 295 | "name": "input", 296 | "type": "bytes" 297 | } 298 | ], 299 | "internalType": "struct ContractDeployer.ForceDeployment[]", 300 | "name": "_deployments", 301 | "type": "tuple[]" 302 | } 303 | ], 304 | "name": "forceDeployOnAddresses", 305 | "outputs": [], 306 | "stateMutability": "payable", 307 | "type": "function" 308 | }, 309 | { 310 | "inputs": [ 311 | { 312 | "internalType": "address", 313 | "name": "_address", 314 | "type": "address" 315 | } 316 | ], 317 | "name": "getAccountInfo", 318 | "outputs": [ 319 | { 320 | "components": [ 321 | { 322 | "internalType": "enum IContractDeployer.AccountAbstractionVersion", 323 | "name": "supportedAAVersion", 324 | "type": "uint8" 325 | }, 326 | { 327 | "internalType": "enum IContractDeployer.AccountNonceOrdering", 328 | "name": "nonceOrdering", 329 | "type": "uint8" 330 | } 331 | ], 332 | "internalType": "struct IContractDeployer.AccountInfo", 333 | "name": "info", 334 | "type": "tuple" 335 | } 336 | ], 337 | "stateMutability": "view", 338 | "type": "function" 339 | }, 340 | { 341 | "inputs": [ 342 | { 343 | "internalType": "address", 344 | "name": "_sender", 345 | "type": "address" 346 | }, 347 | { 348 | "internalType": "uint256", 349 | "name": "_senderNonce", 350 | "type": "uint256" 351 | } 352 | ], 353 | "name": "getNewAddressCreate", 354 | "outputs": [ 355 | { 356 | "internalType": "address", 357 | "name": "newAddress", 358 | "type": "address" 359 | } 360 | ], 361 | "stateMutability": "pure", 362 | "type": "function" 363 | }, 364 | { 365 | "inputs": [ 366 | { 367 | "internalType": "address", 368 | "name": "_sender", 369 | "type": "address" 370 | }, 371 | { 372 | "internalType": "bytes32", 373 | "name": "_bytecodeHash", 374 | "type": "bytes32" 375 | }, 376 | { 377 | "internalType": "bytes32", 378 | "name": "_salt", 379 | "type": "bytes32" 380 | }, 381 | { 382 | "internalType": "bytes", 383 | "name": "_input", 384 | "type": "bytes" 385 | } 386 | ], 387 | "name": "getNewAddressCreate2", 388 | "outputs": [ 389 | { 390 | "internalType": "address", 391 | "name": "newAddress", 392 | "type": "address" 393 | } 394 | ], 395 | "stateMutability": "view", 396 | "type": "function" 397 | }, 398 | { 399 | "inputs": [ 400 | { 401 | "internalType": "enum IContractDeployer.AccountAbstractionVersion", 402 | "name": "_version", 403 | "type": "uint8" 404 | } 405 | ], 406 | "name": "updateAccountVersion", 407 | "outputs": [], 408 | "stateMutability": "nonpayable", 409 | "type": "function" 410 | }, 411 | { 412 | "inputs": [ 413 | { 414 | "internalType": "enum IContractDeployer.AccountNonceOrdering", 415 | "name": "_nonceOrdering", 416 | "type": "uint8" 417 | } 418 | ], 419 | "name": "updateNonceOrdering", 420 | "outputs": [], 421 | "stateMutability": "nonpayable", 422 | "type": "function" 423 | } 424 | ] 425 | } -------------------------------------------------------------------------------- /contract_abi/IAllowList.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "anonymous": false, 5 | "inputs": [ 6 | { 7 | "indexed": true, 8 | "internalType": "address", 9 | "name": "target", 10 | "type": "address" 11 | }, 12 | { 13 | "indexed": false, 14 | "internalType": "enum IAllowList.AccessMode", 15 | "name": "previousMode", 16 | "type": "uint8" 17 | }, 18 | { 19 | "indexed": false, 20 | "internalType": "enum IAllowList.AccessMode", 21 | "name": "newMode", 22 | "type": "uint8" 23 | } 24 | ], 25 | "name": "UpdateAccessMode", 26 | "type": "event" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "address", 34 | "name": "caller", 35 | "type": "address" 36 | }, 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "target", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": true, 45 | "internalType": "bytes4", 46 | "name": "functionSig", 47 | "type": "bytes4" 48 | }, 49 | { 50 | "indexed": false, 51 | "internalType": "bool", 52 | "name": "status", 53 | "type": "bool" 54 | } 55 | ], 56 | "name": "UpdateCallPermission", 57 | "type": "event" 58 | }, 59 | { 60 | "anonymous": false, 61 | "inputs": [ 62 | { 63 | "indexed": true, 64 | "internalType": "address", 65 | "name": "l1Token", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": false, 70 | "internalType": "bool", 71 | "name": "depositLimitation", 72 | "type": "bool" 73 | }, 74 | { 75 | "indexed": false, 76 | "internalType": "uint256", 77 | "name": "depositCap", 78 | "type": "uint256" 79 | } 80 | ], 81 | "name": "UpdateDepositLimit", 82 | "type": "event" 83 | }, 84 | { 85 | "inputs": [ 86 | { 87 | "internalType": "address", 88 | "name": "_caller", 89 | "type": "address" 90 | }, 91 | { 92 | "internalType": "address", 93 | "name": "_target", 94 | "type": "address" 95 | }, 96 | { 97 | "internalType": "bytes4", 98 | "name": "_functionSig", 99 | "type": "bytes4" 100 | } 101 | ], 102 | "name": "canCall", 103 | "outputs": [ 104 | { 105 | "internalType": "bool", 106 | "name": "", 107 | "type": "bool" 108 | } 109 | ], 110 | "stateMutability": "view", 111 | "type": "function" 112 | }, 113 | { 114 | "inputs": [ 115 | { 116 | "internalType": "address", 117 | "name": "_target", 118 | "type": "address" 119 | } 120 | ], 121 | "name": "getAccessMode", 122 | "outputs": [ 123 | { 124 | "internalType": "enum IAllowList.AccessMode", 125 | "name": "", 126 | "type": "uint8" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "address", 136 | "name": "_l1Token", 137 | "type": "address" 138 | } 139 | ], 140 | "name": "getTokenDepositLimitData", 141 | "outputs": [ 142 | { 143 | "components": [ 144 | { 145 | "internalType": "bool", 146 | "name": "depositLimitation", 147 | "type": "bool" 148 | }, 149 | { 150 | "internalType": "uint256", 151 | "name": "depositCap", 152 | "type": "uint256" 153 | } 154 | ], 155 | "internalType": "struct IAllowList.Deposit", 156 | "name": "", 157 | "type": "tuple" 158 | } 159 | ], 160 | "stateMutability": "view", 161 | "type": "function" 162 | }, 163 | { 164 | "inputs": [ 165 | { 166 | "internalType": "address", 167 | "name": "_caller", 168 | "type": "address" 169 | }, 170 | { 171 | "internalType": "address", 172 | "name": "_target", 173 | "type": "address" 174 | }, 175 | { 176 | "internalType": "bytes4", 177 | "name": "_functionSig", 178 | "type": "bytes4" 179 | } 180 | ], 181 | "name": "hasSpecialAccessToCall", 182 | "outputs": [ 183 | { 184 | "internalType": "bool", 185 | "name": "", 186 | "type": "bool" 187 | } 188 | ], 189 | "stateMutability": "view", 190 | "type": "function" 191 | }, 192 | { 193 | "inputs": [ 194 | { 195 | "internalType": "address", 196 | "name": "_target", 197 | "type": "address" 198 | }, 199 | { 200 | "internalType": "enum IAllowList.AccessMode", 201 | "name": "_accessMode", 202 | "type": "uint8" 203 | } 204 | ], 205 | "name": "setAccessMode", 206 | "outputs": [], 207 | "stateMutability": "nonpayable", 208 | "type": "function" 209 | }, 210 | { 211 | "inputs": [ 212 | { 213 | "internalType": "address[]", 214 | "name": "_targets", 215 | "type": "address[]" 216 | }, 217 | { 218 | "internalType": "enum IAllowList.AccessMode[]", 219 | "name": "_accessMode", 220 | "type": "uint8[]" 221 | } 222 | ], 223 | "name": "setBatchAccessMode", 224 | "outputs": [], 225 | "stateMutability": "nonpayable", 226 | "type": "function" 227 | }, 228 | { 229 | "inputs": [ 230 | { 231 | "internalType": "address[]", 232 | "name": "_callers", 233 | "type": "address[]" 234 | }, 235 | { 236 | "internalType": "address[]", 237 | "name": "_targets", 238 | "type": "address[]" 239 | }, 240 | { 241 | "internalType": "bytes4[]", 242 | "name": "_functionSigs", 243 | "type": "bytes4[]" 244 | }, 245 | { 246 | "internalType": "bool[]", 247 | "name": "_enables", 248 | "type": "bool[]" 249 | } 250 | ], 251 | "name": "setBatchPermissionToCall", 252 | "outputs": [], 253 | "stateMutability": "nonpayable", 254 | "type": "function" 255 | }, 256 | { 257 | "inputs": [ 258 | { 259 | "internalType": "address", 260 | "name": "_l1Token", 261 | "type": "address" 262 | }, 263 | { 264 | "internalType": "bool", 265 | "name": "_depositLimitation", 266 | "type": "bool" 267 | }, 268 | { 269 | "internalType": "uint256", 270 | "name": "_depositCap", 271 | "type": "uint256" 272 | } 273 | ], 274 | "name": "setDepositLimit", 275 | "outputs": [], 276 | "stateMutability": "nonpayable", 277 | "type": "function" 278 | }, 279 | { 280 | "inputs": [ 281 | { 282 | "internalType": "address", 283 | "name": "_caller", 284 | "type": "address" 285 | }, 286 | { 287 | "internalType": "address", 288 | "name": "_target", 289 | "type": "address" 290 | }, 291 | { 292 | "internalType": "bytes4", 293 | "name": "_functionSig", 294 | "type": "bytes4" 295 | }, 296 | { 297 | "internalType": "bool", 298 | "name": "_enable", 299 | "type": "bool" 300 | } 301 | ], 302 | "name": "setPermissionToCall", 303 | "outputs": [], 304 | "stateMutability": "nonpayable", 305 | "type": "function" 306 | } 307 | ] 308 | } -------------------------------------------------------------------------------- /contract_abi/IERC1271.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "inputs": [ 5 | { 6 | "internalType": "bytes32", 7 | "name": "hash", 8 | "type": "bytes32" 9 | }, 10 | { 11 | "internalType": "bytes", 12 | "name": "signature", 13 | "type": "bytes" 14 | } 15 | ], 16 | "name": "isValidSignature", 17 | "outputs": [ 18 | { 19 | "internalType": "bytes4", 20 | "name": "magicValue", 21 | "type": "bytes4" 22 | } 23 | ], 24 | "stateMutability": "view", 25 | "type": "function" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /contract_abi/IERC20.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "anonymous": false, 5 | "inputs": [ 6 | { 7 | "indexed": true, 8 | "internalType": "address", 9 | "name": "owner", 10 | "type": "address" 11 | }, 12 | { 13 | "indexed": true, 14 | "internalType": "address", 15 | "name": "spender", 16 | "type": "address" 17 | }, 18 | { 19 | "indexed": false, 20 | "internalType": "uint256", 21 | "name": "value", 22 | "type": "uint256" 23 | } 24 | ], 25 | "name": "Approval", 26 | "type": "event" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "address", 34 | "name": "from", 35 | "type": "address" 36 | }, 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "to", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": false, 45 | "internalType": "uint256", 46 | "name": "value", 47 | "type": "uint256" 48 | } 49 | ], 50 | "name": "Transfer", 51 | "type": "event" 52 | }, 53 | { 54 | "inputs": [ 55 | { 56 | "internalType": "address", 57 | "name": "owner", 58 | "type": "address" 59 | }, 60 | { 61 | "internalType": "address", 62 | "name": "spender", 63 | "type": "address" 64 | } 65 | ], 66 | "name": "allowance", 67 | "outputs": [ 68 | { 69 | "internalType": "uint256", 70 | "name": "", 71 | "type": "uint256" 72 | } 73 | ], 74 | "stateMutability": "view", 75 | "type": "function" 76 | }, 77 | { 78 | "inputs": [ 79 | { 80 | "internalType": "address", 81 | "name": "spender", 82 | "type": "address" 83 | }, 84 | { 85 | "internalType": "uint256", 86 | "name": "amount", 87 | "type": "uint256" 88 | } 89 | ], 90 | "name": "approve", 91 | "outputs": [ 92 | { 93 | "internalType": "bool", 94 | "name": "", 95 | "type": "bool" 96 | } 97 | ], 98 | "stateMutability": "nonpayable", 99 | "type": "function" 100 | }, 101 | { 102 | "inputs": [ 103 | { 104 | "internalType": "address", 105 | "name": "account", 106 | "type": "address" 107 | } 108 | ], 109 | "name": "balanceOf", 110 | "outputs": [ 111 | { 112 | "internalType": "uint256", 113 | "name": "", 114 | "type": "uint256" 115 | } 116 | ], 117 | "stateMutability": "view", 118 | "type": "function" 119 | }, 120 | { 121 | "inputs": [], 122 | "name": "decimals", 123 | "outputs": [ 124 | { 125 | "internalType": "uint8", 126 | "name": "", 127 | "type": "uint8" 128 | } 129 | ], 130 | "stateMutability": "view", 131 | "type": "function" 132 | }, 133 | { 134 | "inputs": [], 135 | "name": "name", 136 | "outputs": [ 137 | { 138 | "internalType": "string", 139 | "name": "", 140 | "type": "string" 141 | } 142 | ], 143 | "stateMutability": "view", 144 | "type": "function" 145 | }, 146 | { 147 | "inputs": [], 148 | "name": "symbol", 149 | "outputs": [ 150 | { 151 | "internalType": "string", 152 | "name": "", 153 | "type": "string" 154 | } 155 | ], 156 | "stateMutability": "view", 157 | "type": "function" 158 | }, 159 | { 160 | "inputs": [], 161 | "name": "totalSupply", 162 | "outputs": [ 163 | { 164 | "internalType": "uint256", 165 | "name": "", 166 | "type": "uint256" 167 | } 168 | ], 169 | "stateMutability": "view", 170 | "type": "function" 171 | }, 172 | { 173 | "inputs": [ 174 | { 175 | "internalType": "address", 176 | "name": "to", 177 | "type": "address" 178 | }, 179 | { 180 | "internalType": "uint256", 181 | "name": "amount", 182 | "type": "uint256" 183 | } 184 | ], 185 | "name": "transfer", 186 | "outputs": [ 187 | { 188 | "internalType": "bool", 189 | "name": "", 190 | "type": "bool" 191 | } 192 | ], 193 | "stateMutability": "nonpayable", 194 | "type": "function" 195 | }, 196 | { 197 | "inputs": [ 198 | { 199 | "internalType": "address", 200 | "name": "from", 201 | "type": "address" 202 | }, 203 | { 204 | "internalType": "address", 205 | "name": "to", 206 | "type": "address" 207 | }, 208 | { 209 | "internalType": "uint256", 210 | "name": "amount", 211 | "type": "uint256" 212 | } 213 | ], 214 | "name": "transferFrom", 215 | "outputs": [ 216 | { 217 | "internalType": "bool", 218 | "name": "", 219 | "type": "bool" 220 | } 221 | ], 222 | "stateMutability": "nonpayable", 223 | "type": "function" 224 | } 225 | ] 226 | } 227 | -------------------------------------------------------------------------------- /contract_abi/IEthToken.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "anonymous": false, 5 | "inputs": [ 6 | { 7 | "indexed": true, 8 | "internalType": "address", 9 | "name": "account", 10 | "type": "address" 11 | }, 12 | { 13 | "indexed": false, 14 | "internalType": "uint256", 15 | "name": "amount", 16 | "type": "uint256" 17 | } 18 | ], 19 | "name": "Mint", 20 | "type": "event" 21 | }, 22 | { 23 | "anonymous": false, 24 | "inputs": [ 25 | { 26 | "indexed": true, 27 | "internalType": "address", 28 | "name": "from", 29 | "type": "address" 30 | }, 31 | { 32 | "indexed": true, 33 | "internalType": "address", 34 | "name": "to", 35 | "type": "address" 36 | }, 37 | { 38 | "indexed": false, 39 | "internalType": "uint256", 40 | "name": "value", 41 | "type": "uint256" 42 | } 43 | ], 44 | "name": "Transfer", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "_l2Sender", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "_l1Receiver", 60 | "type": "address" 61 | }, 62 | { 63 | "indexed": false, 64 | "internalType": "uint256", 65 | "name": "_amount", 66 | "type": "uint256" 67 | } 68 | ], 69 | "name": "Withdrawal", 70 | "type": "event" 71 | }, 72 | { 73 | "anonymous": false, 74 | "inputs": [ 75 | { 76 | "indexed": true, 77 | "internalType": "address", 78 | "name": "_l2Sender", 79 | "type": "address" 80 | }, 81 | { 82 | "indexed": true, 83 | "internalType": "address", 84 | "name": "_l1Receiver", 85 | "type": "address" 86 | }, 87 | { 88 | "indexed": false, 89 | "internalType": "uint256", 90 | "name": "_amount", 91 | "type": "uint256" 92 | }, 93 | { 94 | "indexed": false, 95 | "internalType": "bytes", 96 | "name": "_additionalData", 97 | "type": "bytes" 98 | } 99 | ], 100 | "name": "WithdrawalWithMessage", 101 | "type": "event" 102 | }, 103 | { 104 | "inputs": [ 105 | { 106 | "internalType": "uint256", 107 | "name": "", 108 | "type": "uint256" 109 | } 110 | ], 111 | "name": "balanceOf", 112 | "outputs": [ 113 | { 114 | "internalType": "uint256", 115 | "name": "", 116 | "type": "uint256" 117 | } 118 | ], 119 | "stateMutability": "view", 120 | "type": "function" 121 | }, 122 | { 123 | "inputs": [], 124 | "name": "decimals", 125 | "outputs": [ 126 | { 127 | "internalType": "uint8", 128 | "name": "", 129 | "type": "uint8" 130 | } 131 | ], 132 | "stateMutability": "pure", 133 | "type": "function" 134 | }, 135 | { 136 | "inputs": [ 137 | { 138 | "internalType": "address", 139 | "name": "_account", 140 | "type": "address" 141 | }, 142 | { 143 | "internalType": "uint256", 144 | "name": "_amount", 145 | "type": "uint256" 146 | } 147 | ], 148 | "name": "mint", 149 | "outputs": [], 150 | "stateMutability": "nonpayable", 151 | "type": "function" 152 | }, 153 | { 154 | "inputs": [], 155 | "name": "name", 156 | "outputs": [ 157 | { 158 | "internalType": "string", 159 | "name": "", 160 | "type": "string" 161 | } 162 | ], 163 | "stateMutability": "pure", 164 | "type": "function" 165 | }, 166 | { 167 | "inputs": [], 168 | "name": "symbol", 169 | "outputs": [ 170 | { 171 | "internalType": "string", 172 | "name": "", 173 | "type": "string" 174 | } 175 | ], 176 | "stateMutability": "pure", 177 | "type": "function" 178 | }, 179 | { 180 | "inputs": [], 181 | "name": "totalSupply", 182 | "outputs": [ 183 | { 184 | "internalType": "uint256", 185 | "name": "", 186 | "type": "uint256" 187 | } 188 | ], 189 | "stateMutability": "view", 190 | "type": "function" 191 | }, 192 | { 193 | "inputs": [ 194 | { 195 | "internalType": "address", 196 | "name": "_from", 197 | "type": "address" 198 | }, 199 | { 200 | "internalType": "address", 201 | "name": "_to", 202 | "type": "address" 203 | }, 204 | { 205 | "internalType": "uint256", 206 | "name": "_amount", 207 | "type": "uint256" 208 | } 209 | ], 210 | "name": "transferFromTo", 211 | "outputs": [], 212 | "stateMutability": "nonpayable", 213 | "type": "function" 214 | }, 215 | { 216 | "inputs": [ 217 | { 218 | "internalType": "address", 219 | "name": "_l1Receiver", 220 | "type": "address" 221 | } 222 | ], 223 | "name": "withdraw", 224 | "outputs": [], 225 | "stateMutability": "payable", 226 | "type": "function" 227 | }, 228 | { 229 | "inputs": [ 230 | { 231 | "internalType": "address", 232 | "name": "_l1Receiver", 233 | "type": "address" 234 | }, 235 | { 236 | "internalType": "bytes", 237 | "name": "_additionalData", 238 | "type": "bytes" 239 | } 240 | ], 241 | "name": "withdrawWithMessage", 242 | "outputs": [], 243 | "stateMutability": "payable", 244 | "type": "function" 245 | } 246 | ] 247 | } -------------------------------------------------------------------------------- /contract_abi/IL1Bridge.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "anonymous": false, 5 | "inputs": [ 6 | { 7 | "indexed": true, 8 | "internalType": "address", 9 | "name": "to", 10 | "type": "address" 11 | }, 12 | { 13 | "indexed": true, 14 | "internalType": "address", 15 | "name": "l1Token", 16 | "type": "address" 17 | }, 18 | { 19 | "indexed": false, 20 | "internalType": "uint256", 21 | "name": "amount", 22 | "type": "uint256" 23 | } 24 | ], 25 | "name": "ClaimedFailedDeposit", 26 | "type": "event" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "bytes32", 34 | "name": "l2DepositTxHash", 35 | "type": "bytes32" 36 | }, 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "from", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": true, 45 | "internalType": "address", 46 | "name": "to", 47 | "type": "address" 48 | }, 49 | { 50 | "indexed": false, 51 | "internalType": "address", 52 | "name": "l1Token", 53 | "type": "address" 54 | }, 55 | { 56 | "indexed": false, 57 | "internalType": "uint256", 58 | "name": "amount", 59 | "type": "uint256" 60 | } 61 | ], 62 | "name": "DepositInitiated", 63 | "type": "event" 64 | }, 65 | { 66 | "anonymous": false, 67 | "inputs": [ 68 | { 69 | "indexed": true, 70 | "internalType": "address", 71 | "name": "to", 72 | "type": "address" 73 | }, 74 | { 75 | "indexed": true, 76 | "internalType": "address", 77 | "name": "l1Token", 78 | "type": "address" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "uint256", 83 | "name": "amount", 84 | "type": "uint256" 85 | } 86 | ], 87 | "name": "WithdrawalFinalized", 88 | "type": "event" 89 | }, 90 | { 91 | "inputs": [ 92 | { 93 | "internalType": "address", 94 | "name": "_depositSender", 95 | "type": "address" 96 | }, 97 | { 98 | "internalType": "address", 99 | "name": "_l1Token", 100 | "type": "address" 101 | }, 102 | { 103 | "internalType": "bytes32", 104 | "name": "_l2TxHash", 105 | "type": "bytes32" 106 | }, 107 | { 108 | "internalType": "uint256", 109 | "name": "_l2BatchNumber", 110 | "type": "uint256" 111 | }, 112 | { 113 | "internalType": "uint256", 114 | "name": "_l2MessageIndex", 115 | "type": "uint256" 116 | }, 117 | { 118 | "internalType": "uint16", 119 | "name": "_l2TxNumberInBatch", 120 | "type": "uint16" 121 | }, 122 | { 123 | "internalType": "bytes32[]", 124 | "name": "_merkleProof", 125 | "type": "bytes32[]" 126 | } 127 | ], 128 | "name": "claimFailedDeposit", 129 | "outputs": [], 130 | "stateMutability": "nonpayable", 131 | "type": "function" 132 | }, 133 | { 134 | "inputs": [ 135 | { 136 | "internalType": "address", 137 | "name": "_l2Receiver", 138 | "type": "address" 139 | }, 140 | { 141 | "internalType": "address", 142 | "name": "_l1Token", 143 | "type": "address" 144 | }, 145 | { 146 | "internalType": "uint256", 147 | "name": "_amount", 148 | "type": "uint256" 149 | }, 150 | { 151 | "internalType": "uint256", 152 | "name": "_l2TxGasLimit", 153 | "type": "uint256" 154 | }, 155 | { 156 | "internalType": "uint256", 157 | "name": "_l2TxGasPerPubdataByte", 158 | "type": "uint256" 159 | }, 160 | { 161 | "internalType": "address", 162 | "name": "_refundRecipient", 163 | "type": "address" 164 | } 165 | ], 166 | "name": "deposit", 167 | "outputs": [ 168 | { 169 | "internalType": "bytes32", 170 | "name": "txHash", 171 | "type": "bytes32" 172 | } 173 | ], 174 | "stateMutability": "payable", 175 | "type": "function" 176 | }, 177 | { 178 | "inputs": [ 179 | { 180 | "internalType": "uint256", 181 | "name": "_l2BatchNumber", 182 | "type": "uint256" 183 | }, 184 | { 185 | "internalType": "uint256", 186 | "name": "_l2MessageIndex", 187 | "type": "uint256" 188 | }, 189 | { 190 | "internalType": "uint16", 191 | "name": "_l2TxNumberInBatch", 192 | "type": "uint16" 193 | }, 194 | { 195 | "internalType": "bytes", 196 | "name": "_message", 197 | "type": "bytes" 198 | }, 199 | { 200 | "internalType": "bytes32[]", 201 | "name": "_merkleProof", 202 | "type": "bytes32[]" 203 | } 204 | ], 205 | "name": "finalizeWithdrawal", 206 | "outputs": [], 207 | "stateMutability": "nonpayable", 208 | "type": "function" 209 | }, 210 | { 211 | "inputs": [ 212 | { 213 | "internalType": "uint256", 214 | "name": "_l2BatchNumber", 215 | "type": "uint256" 216 | }, 217 | { 218 | "internalType": "uint256", 219 | "name": "_l2MessageIndex", 220 | "type": "uint256" 221 | } 222 | ], 223 | "name": "isWithdrawalFinalized", 224 | "outputs": [ 225 | { 226 | "internalType": "bool", 227 | "name": "", 228 | "type": "bool" 229 | } 230 | ], 231 | "stateMutability": "view", 232 | "type": "function" 233 | }, 234 | { 235 | "inputs": [], 236 | "name": "l2Bridge", 237 | "outputs": [ 238 | { 239 | "internalType": "address", 240 | "name": "", 241 | "type": "address" 242 | } 243 | ], 244 | "stateMutability": "view", 245 | "type": "function" 246 | }, 247 | { 248 | "inputs": [ 249 | { 250 | "internalType": "address", 251 | "name": "_l1Token", 252 | "type": "address" 253 | } 254 | ], 255 | "name": "l2TokenAddress", 256 | "outputs": [ 257 | { 258 | "internalType": "address", 259 | "name": "", 260 | "type": "address" 261 | } 262 | ], 263 | "stateMutability": "view", 264 | "type": "function" 265 | } 266 | ] 267 | } -------------------------------------------------------------------------------- /contract_abi/IL1Messenger.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "anonymous": false, 5 | "inputs": [ 6 | { 7 | "indexed": false, 8 | "internalType": "bytes32", 9 | "name": "_bytecodeHash", 10 | "type": "bytes32" 11 | } 12 | ], 13 | "name": "BytecodeL1PublicationRequested", 14 | "type": "event" 15 | }, 16 | { 17 | "anonymous": false, 18 | "inputs": [ 19 | { 20 | "indexed": true, 21 | "internalType": "address", 22 | "name": "_sender", 23 | "type": "address" 24 | }, 25 | { 26 | "indexed": true, 27 | "internalType": "bytes32", 28 | "name": "_hash", 29 | "type": "bytes32" 30 | }, 31 | { 32 | "indexed": false, 33 | "internalType": "bytes", 34 | "name": "_message", 35 | "type": "bytes" 36 | } 37 | ], 38 | "name": "L1MessageSent", 39 | "type": "event" 40 | }, 41 | { 42 | "anonymous": false, 43 | "inputs": [ 44 | { 45 | "components": [ 46 | { 47 | "internalType": "uint8", 48 | "name": "l2ShardId", 49 | "type": "uint8" 50 | }, 51 | { 52 | "internalType": "bool", 53 | "name": "isService", 54 | "type": "bool" 55 | }, 56 | { 57 | "internalType": "uint16", 58 | "name": "txNumberInBlock", 59 | "type": "uint16" 60 | }, 61 | { 62 | "internalType": "address", 63 | "name": "sender", 64 | "type": "address" 65 | }, 66 | { 67 | "internalType": "bytes32", 68 | "name": "key", 69 | "type": "bytes32" 70 | }, 71 | { 72 | "internalType": "bytes32", 73 | "name": "value", 74 | "type": "bytes32" 75 | } 76 | ], 77 | "indexed": false, 78 | "internalType": "struct L2ToL1Log", 79 | "name": "_l2log", 80 | "type": "tuple" 81 | } 82 | ], 83 | "name": "L2ToL1LogSent", 84 | "type": "event" 85 | }, 86 | { 87 | "inputs": [ 88 | { 89 | "internalType": "bytes32", 90 | "name": "_bytecodeHash", 91 | "type": "bytes32" 92 | } 93 | ], 94 | "name": "requestBytecodeL1Publication", 95 | "outputs": [], 96 | "stateMutability": "nonpayable", 97 | "type": "function" 98 | }, 99 | { 100 | "inputs": [ 101 | { 102 | "internalType": "bool", 103 | "name": "_isService", 104 | "type": "bool" 105 | }, 106 | { 107 | "internalType": "bytes32", 108 | "name": "_key", 109 | "type": "bytes32" 110 | }, 111 | { 112 | "internalType": "bytes32", 113 | "name": "_value", 114 | "type": "bytes32" 115 | } 116 | ], 117 | "name": "sendL2ToL1Log", 118 | "outputs": [ 119 | { 120 | "internalType": "uint256", 121 | "name": "logIdInMerkleTree", 122 | "type": "uint256" 123 | } 124 | ], 125 | "stateMutability": "nonpayable", 126 | "type": "function" 127 | }, 128 | { 129 | "inputs": [ 130 | { 131 | "internalType": "bytes", 132 | "name": "_message", 133 | "type": "bytes" 134 | } 135 | ], 136 | "name": "sendToL1", 137 | "outputs": [ 138 | { 139 | "internalType": "bytes32", 140 | "name": "", 141 | "type": "bytes32" 142 | } 143 | ], 144 | "stateMutability": "nonpayable", 145 | "type": "function" 146 | } 147 | ] 148 | } -------------------------------------------------------------------------------- /contract_abi/IL2Bridge.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "inputs": [ 5 | { 6 | "internalType": "address", 7 | "name": "_l1Sender", 8 | "type": "address" 9 | }, 10 | { 11 | "internalType": "address", 12 | "name": "_l2Receiver", 13 | "type": "address" 14 | }, 15 | { 16 | "internalType": "address", 17 | "name": "_l1Token", 18 | "type": "address" 19 | }, 20 | { 21 | "internalType": "uint256", 22 | "name": "_amount", 23 | "type": "uint256" 24 | }, 25 | { 26 | "internalType": "bytes", 27 | "name": "_data", 28 | "type": "bytes" 29 | } 30 | ], 31 | "name": "finalizeDeposit", 32 | "outputs": [], 33 | "stateMutability": "payable", 34 | "type": "function" 35 | }, 36 | { 37 | "inputs": [], 38 | "name": "l1Bridge", 39 | "outputs": [ 40 | { 41 | "internalType": "address", 42 | "name": "", 43 | "type": "address" 44 | } 45 | ], 46 | "stateMutability": "view", 47 | "type": "function" 48 | }, 49 | { 50 | "inputs": [ 51 | { 52 | "internalType": "address", 53 | "name": "_l2Token", 54 | "type": "address" 55 | } 56 | ], 57 | "name": "l1TokenAddress", 58 | "outputs": [ 59 | { 60 | "internalType": "address", 61 | "name": "", 62 | "type": "address" 63 | } 64 | ], 65 | "stateMutability": "view", 66 | "type": "function" 67 | }, 68 | { 69 | "inputs": [ 70 | { 71 | "internalType": "address", 72 | "name": "_l1Token", 73 | "type": "address" 74 | } 75 | ], 76 | "name": "l2TokenAddress", 77 | "outputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "", 81 | "type": "address" 82 | } 83 | ], 84 | "stateMutability": "view", 85 | "type": "function" 86 | }, 87 | { 88 | "inputs": [ 89 | { 90 | "internalType": "address", 91 | "name": "_l1Receiver", 92 | "type": "address" 93 | }, 94 | { 95 | "internalType": "address", 96 | "name": "_l2Token", 97 | "type": "address" 98 | }, 99 | { 100 | "internalType": "uint256", 101 | "name": "_amount", 102 | "type": "uint256" 103 | } 104 | ], 105 | "name": "withdraw", 106 | "outputs": [], 107 | "stateMutability": "nonpayable", 108 | "type": "function" 109 | } 110 | ] 111 | } -------------------------------------------------------------------------------- /contract_abi/INonceHolder.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "accountAddress", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "uint256", 14 | "name": "key", 15 | "type": "uint256" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "value", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "ValueSetUnderNonce", 25 | "type": "event" 26 | }, 27 | { 28 | "inputs": [ 29 | { 30 | "internalType": "address", 31 | "name": "_address", 32 | "type": "address" 33 | } 34 | ], 35 | "name": "getDeploymentNonce", 36 | "outputs": [ 37 | { 38 | "internalType": "uint256", 39 | "name": "", 40 | "type": "uint256" 41 | } 42 | ], 43 | "stateMutability": "view", 44 | "type": "function" 45 | }, 46 | { 47 | "inputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "_address", 51 | "type": "address" 52 | } 53 | ], 54 | "name": "getMinNonce", 55 | "outputs": [ 56 | { 57 | "internalType": "uint256", 58 | "name": "", 59 | "type": "uint256" 60 | } 61 | ], 62 | "stateMutability": "view", 63 | "type": "function" 64 | }, 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "address", 69 | "name": "_address", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "getRawNonce", 74 | "outputs": [ 75 | { 76 | "internalType": "uint256", 77 | "name": "", 78 | "type": "uint256" 79 | } 80 | ], 81 | "stateMutability": "view", 82 | "type": "function" 83 | }, 84 | { 85 | "inputs": [ 86 | { 87 | "internalType": "uint256", 88 | "name": "_key", 89 | "type": "uint256" 90 | } 91 | ], 92 | "name": "getValueUnderNonce", 93 | "outputs": [ 94 | { 95 | "internalType": "uint256", 96 | "name": "", 97 | "type": "uint256" 98 | } 99 | ], 100 | "stateMutability": "view", 101 | "type": "function" 102 | }, 103 | { 104 | "inputs": [ 105 | { 106 | "internalType": "uint256", 107 | "name": "_value", 108 | "type": "uint256" 109 | } 110 | ], 111 | "name": "increaseMinNonce", 112 | "outputs": [ 113 | { 114 | "internalType": "uint256", 115 | "name": "", 116 | "type": "uint256" 117 | } 118 | ], 119 | "stateMutability": "nonpayable", 120 | "type": "function" 121 | }, 122 | { 123 | "inputs": [ 124 | { 125 | "internalType": "address", 126 | "name": "_address", 127 | "type": "address" 128 | } 129 | ], 130 | "name": "incrementDeploymentNonce", 131 | "outputs": [ 132 | { 133 | "internalType": "uint256", 134 | "name": "", 135 | "type": "uint256" 136 | } 137 | ], 138 | "stateMutability": "nonpayable", 139 | "type": "function" 140 | }, 141 | { 142 | "inputs": [ 143 | { 144 | "internalType": "uint256", 145 | "name": "_expectedNonce", 146 | "type": "uint256" 147 | } 148 | ], 149 | "name": "incrementMinNonceIfEquals", 150 | "outputs": [], 151 | "stateMutability": "nonpayable", 152 | "type": "function" 153 | }, 154 | { 155 | "inputs": [ 156 | { 157 | "internalType": "address", 158 | "name": "_address", 159 | "type": "address" 160 | }, 161 | { 162 | "internalType": "uint256", 163 | "name": "_nonce", 164 | "type": "uint256" 165 | } 166 | ], 167 | "name": "isNonceUsed", 168 | "outputs": [ 169 | { 170 | "internalType": "bool", 171 | "name": "", 172 | "type": "bool" 173 | } 174 | ], 175 | "stateMutability": "view", 176 | "type": "function" 177 | }, 178 | { 179 | "inputs": [ 180 | { 181 | "internalType": "uint256", 182 | "name": "_key", 183 | "type": "uint256" 184 | }, 185 | { 186 | "internalType": "uint256", 187 | "name": "_value", 188 | "type": "uint256" 189 | } 190 | ], 191 | "name": "setValueUnderNonce", 192 | "outputs": [], 193 | "stateMutability": "nonpayable", 194 | "type": "function" 195 | }, 196 | { 197 | "inputs": [ 198 | { 199 | "internalType": "address", 200 | "name": "_address", 201 | "type": "address" 202 | }, 203 | { 204 | "internalType": "uint256", 205 | "name": "_key", 206 | "type": "uint256" 207 | }, 208 | { 209 | "internalType": "bool", 210 | "name": "_shouldBeUsed", 211 | "type": "bool" 212 | } 213 | ], 214 | "name": "validateNonceUsage", 215 | "outputs": [], 216 | "stateMutability": "view", 217 | "type": "function" 218 | } 219 | ] -------------------------------------------------------------------------------- /contract_abi/IPaymasterFlow.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "inputs": [ 5 | { 6 | "internalType": "address", 7 | "name": "_token", 8 | "type": "address" 9 | }, 10 | { 11 | "internalType": "uint256", 12 | "name": "_minAllowance", 13 | "type": "uint256" 14 | }, 15 | { 16 | "internalType": "bytes", 17 | "name": "_innerInput", 18 | "type": "bytes" 19 | } 20 | ], 21 | "name": "approvalBased", 22 | "outputs": [], 23 | "stateMutability": "nonpayable", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [ 28 | { 29 | "internalType": "bytes", 30 | "name": "input", 31 | "type": "bytes" 32 | } 33 | ], 34 | "name": "general", 35 | "outputs": [], 36 | "stateMutability": "nonpayable", 37 | "type": "function" 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /contract_abi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Elez-dev/ZksyncPaymaster/edb47a0e9dca5142e988fb35a5164cf05c23f708/contract_abi/__init__.py -------------------------------------------------------------------------------- /data/accounts_data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Elez-dev/ZksyncPaymaster/edb47a0e9dca5142e988fb35a5164cf05c23f708/data/accounts_data.xlsx -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from sys import stdout 2 | from modules import * 3 | from settings import * 4 | 5 | 6 | logger.remove() 7 | logger.add("./data/log.txt") 8 | logger.add(stdout, format="{time:YYYY-MM-DD HH:mm:ss} | {level: <7} | {message}") 9 | web3_eth = Web3(Web3.HTTPProvider(CHAIN_RPC['Ethereum'], request_kwargs={'timeout': 60})) 10 | 11 | 12 | class Worker: 13 | 14 | @staticmethod 15 | def remove_crlf(input_string): 16 | return input_string.replace("\r", "").replace("\n", "") 17 | 18 | def work(self): 19 | i = 0 20 | for number, key in keys_list: 21 | str_number = f'{number} / {all_wallets}' 22 | self.remove_crlf(key) 23 | 24 | i += 1 25 | address = web3_eth.eth.account.from_key(key).address 26 | logger.info(f'Account #{i} || {address}\n') 27 | 28 | dexs = [ 29 | SynkSwap, 30 | Velocore, 31 | Mute 32 | ] 33 | number_trans = random.randint(NUMBER_TRANS[0], NUMBER_TRANS[1]) 34 | logger.info(f'Количество транзакций - {number_trans}\n') 35 | dex = random.choice(dexs)(key, str_number) 36 | for _ in range(number_trans): 37 | token = dex.buy_token() 38 | sleeping(TIME_DELAY[0], TIME_DELAY[1]) 39 | dex.sold_token(token) 40 | sleeping(TIME_DELAY[0], TIME_DELAY[1]) 41 | 42 | logger.success(f'Account completed, sleep and move on to the next one\n') 43 | sleeping(TIME_ACCOUNT_DELAY[0], TIME_ACCOUNT_DELAY[1]) 44 | 45 | 46 | if __name__ == '__main__': 47 | list1 = get_accounts_data() 48 | all_wallets = len(list1) 49 | logger.info(f'Number of wallets: {all_wallets}\n') 50 | keys_list = shuffle(list1) 51 | worker = Worker() 52 | worker.work() 53 | -------------------------------------------------------------------------------- /modules/__init__.py: -------------------------------------------------------------------------------- 1 | from .eip712struct import * 2 | from .func import * 3 | from .mute import * 4 | from .paymaster import * 5 | from .retry import * 6 | from .sign_messgae import * 7 | from .syncswap import * 8 | from .velocore import * 9 | from .wallet import * 10 | -------------------------------------------------------------------------------- /modules/eip712struct.py: -------------------------------------------------------------------------------- 1 | from collections import OrderedDict, defaultdict 2 | from typing import List, Tuple, NamedTuple 3 | from eth_utils.crypto import keccak 4 | from json import JSONEncoder 5 | from typing import Any, Union, Type 6 | from eth_utils.conversions import to_bytes, to_hex, to_int 7 | 8 | import re 9 | import functools 10 | import json 11 | import operator 12 | 13 | 14 | class EIP712Type: 15 | """The base type for members of a struct. 16 | 17 | Generally you wouldn't use this - instead, see the subclasses below. Or you may want an EIP712Struct instead. 18 | """ 19 | 20 | def __init__(self, type_name: str, none_val: Any): 21 | self.type_name = type_name 22 | self.none_val = none_val 23 | 24 | def encode_value(self, value) -> bytes: 25 | """Given a value, verify it and convert into the format required by the spec. 26 | 27 | :param value: A correct input value for the implemented type. 28 | :return: A 32-byte object containing encoded data 29 | """ 30 | if value is None: 31 | return self._encode_value(self.none_val) 32 | else: 33 | return self._encode_value(value) 34 | 35 | def _encode_value(self, value) -> bytes: 36 | """Must be implemented by subclasses, handles value encoding on a case-by-case basis. 37 | 38 | Don't call this directly - use ``.encode_value(value)`` instead. 39 | """ 40 | pass 41 | 42 | def __eq__(self, other): 43 | self_type = getattr(self, "type_name") 44 | other_type = getattr(other, "type_name") 45 | 46 | return self_type is not None and self_type == other_type 47 | 48 | def __hash__(self): 49 | return hash(self.type_name) 50 | 51 | 52 | class Array(EIP712Type): 53 | def __init__( 54 | self, member_type: Union[EIP712Type, Type[EIP712Type]], fixed_length: int = 0 55 | ): 56 | """Represents an array member type. 57 | 58 | Example: 59 | a1 = Array(String()) # string[] a1 60 | a2 = Array(String(), 8) # string[8] a2 61 | a3 = Array(MyStruct) # MyStruct[] a3 62 | """ 63 | fixed_length = int(fixed_length) 64 | if fixed_length == 0: 65 | type_name = f"{member_type.type_name}[]" 66 | else: 67 | type_name = f"{member_type.type_name}[{fixed_length}]" 68 | self.member_type = member_type 69 | self.fixed_length = fixed_length 70 | super(Array, self).__init__(type_name, []) 71 | 72 | def _encode_value(self, value): 73 | """Arrays are encoded by concatenating their encoded contents, and taking the keccak256 hash.""" 74 | encoder = self.member_type 75 | encoded_values = [encoder.encode_value(v) for v in value] 76 | return keccak(b"".join(encoded_values)) 77 | 78 | 79 | class Address(EIP712Type): 80 | def __init__(self): 81 | """Represents an ``address`` type.""" 82 | super(Address, self).__init__("address", 0) 83 | 84 | def _encode_value(self, value): 85 | """Addresses are encoded like Uint160 numbers.""" 86 | 87 | # Some smart conversions - need to get the address to a numeric before we encode it 88 | if isinstance(value, bytes): 89 | v = to_int(value) 90 | elif isinstance(value, str): 91 | v = to_int(hexstr=value) 92 | else: 93 | v = value # Fallback, just use it as-is. 94 | return Uint(160).encode_value(v) 95 | 96 | 97 | class Boolean(EIP712Type): 98 | def __init__(self): 99 | """Represents a ``bool`` type.""" 100 | super(Boolean, self).__init__("bool", False) 101 | 102 | def _encode_value(self, value): 103 | """Booleans are encoded like the uint256 values of 0 and 1.""" 104 | if value is False: 105 | return Uint(256).encode_value(0) 106 | elif value is True: 107 | return Uint(256).encode_value(1) 108 | else: 109 | raise ValueError(f"Must be True or False. Got: {value}") 110 | 111 | 112 | class Bytes(EIP712Type): 113 | def __init__(self, length: int = 0): 114 | """Represents a solidity bytes type. 115 | 116 | Length may be used to specify a static ``bytesN`` type. Or 0 for a dynamic ``bytes`` type. 117 | Example: 118 | b1 = Bytes() # bytes b1 119 | b2 = Bytes(10) # bytes10 b2 120 | 121 | ``length`` MUST be between 0 and 32, or a ValueError is raised. 122 | """ 123 | length = int(length) 124 | if length == 0: 125 | # Special case: Length of 0 means a dynamic bytes type 126 | type_name = "bytes" 127 | elif 1 <= length <= 32: 128 | type_name = f"bytes{length}" 129 | else: 130 | raise ValueError(f"Byte length must be between 1 or 32. Got: {length}") 131 | self.length = length 132 | super(Bytes, self).__init__(type_name, b"") 133 | 134 | def _encode_value(self, value): 135 | """Static bytesN types are encoded by right-padding to 32 bytes. Dynamic bytes types are keccak256 hashed.""" 136 | if isinstance(value, str): 137 | # Try converting to a bytestring, assuming that it's been given as hex 138 | value = to_bytes(hexstr=value) 139 | 140 | if self.length == 0: 141 | return keccak(value) 142 | else: 143 | if len(value) > self.length: 144 | raise ValueError( 145 | f"{self.type_name} was given bytes with length {len(value)}" 146 | ) 147 | padding = bytes(32 - len(value)) 148 | return value + padding 149 | 150 | 151 | class Int(EIP712Type): 152 | def __init__(self, length: int = 256): 153 | """Represents a signed int type. Length may be given to specify the int length in bits. Default length is 256 154 | 155 | Example: 156 | i1 = Int(256) # int256 i1 157 | i2 = Int() # int256 i2 158 | i3 = Int(128) # int128 i3 159 | """ 160 | length = int(length) 161 | if length < 8 or length > 256 or length % 8 != 0: 162 | raise ValueError( 163 | f"Int length must be a multiple of 8, between 8 and 256. Got: {length}" 164 | ) 165 | self.length = length 166 | super(Int, self).__init__(f"int{length}", 0) 167 | 168 | def _encode_value(self, value: int): 169 | """Ints are encoded by padding them to 256-bit representations.""" 170 | value.to_bytes(self.length // 8, byteorder="big", signed=True) # For validation 171 | return value.to_bytes(32, byteorder="big", signed=True) 172 | 173 | 174 | class String(EIP712Type): 175 | def __init__(self): 176 | """Represents a string type.""" 177 | super(String, self).__init__("string", "") 178 | 179 | def _encode_value(self, value): 180 | """Strings are encoded by taking the keccak256 hash of their contents.""" 181 | return keccak(text=value) 182 | 183 | 184 | class Uint(EIP712Type): 185 | def __init__(self, length: int = 256): 186 | """Represents an unsigned int type. Length may be given to specify the int length in bits. Default length is 256 187 | 188 | Example: 189 | ui1 = Uint(256) # uint256 ui1 190 | ui2 = Uint() # uint256 ui2 191 | ui3 = Uint(128) # uint128 ui3 192 | """ 193 | length = int(length) 194 | if length < 8 or length > 256 or length % 8 != 0: 195 | raise ValueError( 196 | f"Uint length must be a multiple of 8, between 8 and 256. Got: {length}" 197 | ) 198 | self.length = length 199 | super(Uint, self).__init__(f"uint{length}", 0) 200 | 201 | def _encode_value(self, value: int): 202 | """Uints are encoded by padding them to 256-bit representations.""" 203 | value.to_bytes( 204 | self.length // 8, byteorder="big", signed=False 205 | ) # For validation 206 | return value.to_bytes(32, byteorder="big", signed=False) 207 | 208 | 209 | solidity_type_map = { 210 | "address": Address, 211 | "bool": Boolean, 212 | "bytes": Bytes, 213 | "int": Int, 214 | "string": String, 215 | "uint": Uint, 216 | } 217 | 218 | 219 | def from_solidity_type(solidity_type: str): 220 | """Convert a string into the EIP712Type implementation. Basic types only.""" 221 | pattern = r"([a-z]+)(\d+)?(\[(\d+)?\])?" 222 | match = re.match(pattern, solidity_type) 223 | 224 | if match is None: 225 | return None 226 | 227 | type_name = match.group(1) # The type name, like the "bytes" in "bytes32" 228 | opt_len = match.group(2) # An optional length spec, like the "32" in "bytes32" 229 | is_array = match.group(3) # Basically just checks for square brackets 230 | array_len = match.group(4) # For fixed length arrays only, this is the length 231 | 232 | if type_name not in solidity_type_map: 233 | # Only supporting basic types here - return None if we don't recognize it. 234 | return None 235 | 236 | # Construct the basic type 237 | base_type = solidity_type_map[type_name] 238 | if opt_len: 239 | type_instance = base_type(int(opt_len)) 240 | else: 241 | type_instance = base_type() 242 | 243 | if is_array: 244 | # Nest the aforementioned basic type into an Array. 245 | if array_len: 246 | result = Array(type_instance, int(array_len)) 247 | else: 248 | result = Array(type_instance) 249 | return result 250 | else: 251 | return type_instance 252 | 253 | 254 | class BytesJSONEncoder(JSONEncoder): 255 | def default(self, o): 256 | if isinstance(o, bytes): 257 | return to_hex(o) 258 | else: 259 | return super(BytesJSONEncoder, self).default(o) 260 | 261 | 262 | class OrderedAttributesMeta(type): 263 | """Metaclass to ensure struct attribute order is preserved.""" 264 | 265 | @classmethod 266 | def __prepare__(mcs, name, bases): 267 | return OrderedDict() 268 | 269 | 270 | class EIP712Struct(EIP712Type, metaclass=OrderedAttributesMeta): 271 | """A representation of an EIP712 struct. Subclass it to use it. 272 | 273 | Example: 274 | from eip712_structs import EIP712Struct, String 275 | 276 | class MyStruct(EIP712Struct): 277 | some_param = String() 278 | 279 | struct_instance = MyStruct(some_param='some_value') 280 | """ 281 | 282 | def __init__(self, **kwargs): 283 | super(EIP712Struct, self).__init__(self.type_name, None) 284 | members = self.get_members() 285 | self.values = dict() 286 | for name, typ in members: 287 | value = kwargs.get(name) 288 | if isinstance(value, dict): 289 | value = typ(**value) 290 | self.values[name] = value 291 | 292 | @classmethod 293 | def __init_subclass__(cls, **kwargs): 294 | super().__init_subclass__(**kwargs) 295 | cls.type_name = cls.__name__ 296 | 297 | def encode_value(self, value=None): 298 | """Returns the struct's encoded value. 299 | 300 | A struct's encoded value is a concatenation of the bytes32 representation of each member of the struct. 301 | Order is preserved. 302 | 303 | :param value: This parameter is not used for structs. 304 | """ 305 | encoded_values = list() 306 | for name, typ in self.get_members(): 307 | if isinstance(typ, type) and issubclass(typ, EIP712Struct): 308 | # Nested structs are recursively hashed, with the resulting 32-byte hash appended to the list of values 309 | sub_struct = self.get_data_value(name) 310 | encoded_values.append(sub_struct.hash_struct()) 311 | else: 312 | # Regular types are encoded as normal 313 | encoded_values.append(typ.encode_value(self.values[name])) 314 | return b"".join(encoded_values) 315 | 316 | def get_data_value(self, name): 317 | """Get the value of the given struct parameter.""" 318 | return self.values.get(name) 319 | 320 | def set_data_value(self, name, value): 321 | """Set the value of the given struct parameter.""" 322 | if name in self.values: 323 | self.values[name] = value 324 | 325 | def data_dict(self): 326 | """Provide the entire data dictionary representing the struct. 327 | 328 | Nested structs instances are also converted to dict form. 329 | """ 330 | result = dict() 331 | for k, v in self.values.items(): 332 | if isinstance(v, EIP712Struct): 333 | result[k] = v.data_dict() 334 | else: 335 | result[k] = v 336 | return result 337 | 338 | @classmethod 339 | def _encode_type(cls, resolve_references: bool) -> str: 340 | member_sigs = [f"{typ.type_name} {name}" for name, typ in cls.get_members()] 341 | struct_sig = f'{cls.type_name}({",".join(member_sigs)})' 342 | 343 | if resolve_references: 344 | reference_structs = set() 345 | cls._gather_reference_structs(reference_structs) 346 | sorted_structs = sorted( 347 | list(s for s in reference_structs if s != cls), 348 | key=lambda s: s.type_name, 349 | ) 350 | for struct in sorted_structs: 351 | struct_sig += struct._encode_type(resolve_references=False) 352 | return struct_sig 353 | 354 | @classmethod 355 | def _gather_reference_structs(cls, struct_set): 356 | """Finds reference structs defined in this struct type, and inserts them into the given set.""" 357 | structs = [ 358 | m[1] 359 | for m in cls.get_members() 360 | if isinstance(m[1], type) and issubclass(m[1], EIP712Struct) 361 | ] 362 | for struct in structs: 363 | if struct not in struct_set: 364 | struct_set.add(struct) 365 | struct._gather_reference_structs(struct_set) 366 | 367 | @classmethod 368 | def encode_type(cls): 369 | """Get the encoded type signature of the struct. 370 | 371 | Nested structs are also encoded, and appended in alphabetical order. 372 | """ 373 | return cls._encode_type(True) 374 | 375 | @classmethod 376 | def type_hash(cls) -> bytes: 377 | """Get the keccak hash of the struct's encoded type.""" 378 | return keccak(text=cls.encode_type()) 379 | 380 | def hash_struct(self) -> bytes: 381 | """The hash of the struct. 382 | 383 | hash_struct => keccak(type_hash || encode_data) 384 | """ 385 | return keccak(b"".join([self.type_hash(), self.encode_value()])) 386 | 387 | @classmethod 388 | def get_members(cls) -> List[Tuple[str, EIP712Type]]: 389 | """A list of tuples of supported parameters. 390 | 391 | Each tuple is (, ). The list's order is determined by definition order. 392 | """ 393 | members = [ 394 | m 395 | for m in cls.__dict__.items() 396 | if isinstance(m[1], EIP712Type) 397 | or (isinstance(m[1], type) and issubclass(m[1], EIP712Struct)) 398 | ] 399 | return members 400 | 401 | @staticmethod 402 | def _assert_domain(domain): 403 | result = domain or None 404 | if not result: 405 | raise ValueError( 406 | "Domain must be provided, or eip712.default_domain must be set." 407 | ) 408 | return result 409 | 410 | def to_message(self, domain: "EIP712Struct" = None) -> dict: 411 | """Convert a struct into a dictionary suitable for messaging. 412 | 413 | Dictionary is of the form: 414 | { 415 | 'primaryType': Name of the primary type, 416 | 'types': Definition of each included struct type (including the domain type) 417 | 'domain': Values for the domain struct, 418 | 'message': Values for the message struct, 419 | } 420 | 421 | :returns: This struct + the domain in dict form, structured as specified for EIP712 messages. 422 | """ 423 | domain = self._assert_domain(domain) 424 | structs = {domain, self} 425 | self._gather_reference_structs(structs) 426 | 427 | # Build type dictionary 428 | types = dict() 429 | for struct in structs: 430 | members_json = [ 431 | { 432 | "name": m[0], 433 | "type": m[1].type_name, 434 | } 435 | for m in struct.get_members() 436 | ] 437 | types[struct.type_name] = members_json 438 | 439 | result = { 440 | "primaryType": self.type_name, 441 | "types": types, 442 | "domain": domain.data_dict(), 443 | "message": self.data_dict(), 444 | } 445 | 446 | return result 447 | 448 | def to_message_json(self, domain: "EIP712Struct" = None) -> str: 449 | message = self.to_message(domain) 450 | return json.dumps(message, cls=BytesJSONEncoder) 451 | 452 | def signable_bytes(self, domain: "EIP712Struct" = None) -> bytes: 453 | """Return a ``bytes`` object suitable for signing, as specified for EIP712. 454 | 455 | As per the spec, bytes are constructed as follows: 456 | ``b'\x19\x01' + domain_hash_bytes + struct_hash_bytes`` 457 | 458 | :param domain: The domain to include in the hash bytes. If None, uses ``eip712_structs.default_domain`` 459 | :return: The bytes object 460 | """ 461 | domain = self._assert_domain(domain) 462 | result = b"\x19\x01" + domain.hash_struct() + self.hash_struct() 463 | return result 464 | 465 | @classmethod 466 | def from_message(cls, message_dict: dict) -> "StructTuple": 467 | """Convert a message dictionary into two EIP712Struct objects - one for domain, another for the message struct. 468 | 469 | Returned as a StructTuple, which has the attributes ``message`` and ``domain``. 470 | 471 | Example: 472 | my_msg = { .. } 473 | deserialized = EIP712Struct.from_message(my_msg) 474 | msg_struct = deserialized.message 475 | domain_struct = deserialized.domain 476 | 477 | :param message_dict: The dictionary, such as what is produced by EIP712Struct.to_message. 478 | :return: A StructTuple object, containing the message and domain structs. 479 | """ 480 | structs = dict() 481 | unfulfilled_struct_params = defaultdict(list) 482 | 483 | for type_name in message_dict["types"]: 484 | # Dynamically construct struct class from dict representation 485 | StructFromJSON = type(type_name, (EIP712Struct,), {}) 486 | 487 | for member in message_dict["types"][type_name]: 488 | # Either a basic solidity type is set, or None if referring to a reference struct (we'll fill it later) 489 | member_name = member["name"] 490 | member_sol_type = from_solidity_type(member["type"]) 491 | setattr(StructFromJSON, member_name, member_sol_type) 492 | if member_sol_type is None: 493 | # Track the refs we'll need to set later. 494 | unfulfilled_struct_params[type_name].append( 495 | (member_name, member["type"]) 496 | ) 497 | 498 | structs[type_name] = StructFromJSON 499 | 500 | # Now that custom structs have been parsed, pass through again to set the references 501 | for struct_name, unfulfilled_member_names in unfulfilled_struct_params.items(): 502 | regex_pattern = r"([a-zA-Z0-9_]+)(\[(\d+)?\])?" 503 | 504 | struct_class = structs[struct_name] 505 | for name, type_name in unfulfilled_member_names: 506 | match = re.match(regex_pattern, type_name) 507 | base_type_name = match.group(1) 508 | ref_struct = structs[base_type_name] 509 | if match.group(2): 510 | # The type is an array of the struct 511 | arr_len = ( 512 | match.group(3) or 0 513 | ) # length of 0 means the array is dynamically sized 514 | setattr(struct_class, name, Array(ref_struct, arr_len)) 515 | else: 516 | setattr(struct_class, name, ref_struct) 517 | 518 | primary_struct = structs[message_dict["primaryType"]] 519 | domain_struct = structs["EIP712Domain"] 520 | 521 | primary_result = primary_struct(**message_dict["message"]) 522 | domain_result = domain_struct(**message_dict["domain"]) 523 | result = StructTuple(message=primary_result, domain=domain_result) 524 | 525 | return result 526 | 527 | @classmethod 528 | def _assert_key_is_member(cls, key): 529 | member_names = {tup[0] for tup in cls.get_members()} 530 | if key not in member_names: 531 | raise KeyError(f'"{key}" is not defined for this struct.') 532 | 533 | @classmethod 534 | def _assert_property_type(cls, key, value): 535 | """Eagerly check for a correct member type""" 536 | members = dict(cls.get_members()) 537 | typ = members[key] 538 | 539 | if isinstance(typ, type) and issubclass(typ, EIP712Struct): 540 | # We expect an EIP712Struct instance. Assert that's true, and check the struct signature too. 541 | if not isinstance(value, EIP712Struct) or value._encode_type( 542 | False 543 | ) != typ._encode_type(False): 544 | raise ValueError( 545 | f"Given value is of type {type(value)}, but we expected {typ}" 546 | ) 547 | else: 548 | # Since it isn't a nested struct, its an EIP712Type 549 | try: 550 | typ.encode_value(value) 551 | except Exception as e: 552 | raise ValueError( 553 | f"The python type {type(value)} does not appear " 554 | f"to be supported for data type {typ}." 555 | ) from e 556 | 557 | def __getitem__(self, key): 558 | """Provide access directly to the underlying value dictionary""" 559 | self._assert_key_is_member(key) 560 | return self.values.__getitem__(key) 561 | 562 | def __setitem__(self, key, value): 563 | """Provide access directly to the underlying value dictionary""" 564 | self._assert_key_is_member(key) 565 | self._assert_property_type(key, value) 566 | 567 | return self.values.__setitem__(key, value) 568 | 569 | def __delitem__(self, _): 570 | raise TypeError("Deleting entries from an EIP712Struct is not allowed.") 571 | 572 | def __eq__(self, other): 573 | if not other: 574 | # Null check 575 | return False 576 | if self is other: 577 | # Check identity 578 | return True 579 | if not isinstance(other, EIP712Struct): 580 | # Check class 581 | return False 582 | # Our structs are considered equal if their type signature and encoded value signature match. 583 | # E.g., like computing signable bytes but without a domain separator 584 | return ( 585 | self.encode_type() == other.encode_type() 586 | and self.encode_value() == other.encode_value() 587 | ) 588 | 589 | def __hash__(self): 590 | value_hashes = [hash(k) ^ hash(v) for k, v in self.values.items()] 591 | return functools.reduce(operator.xor, value_hashes, hash(self.type_name)) 592 | 593 | 594 | class StructTuple(NamedTuple): 595 | message: EIP712Struct 596 | domain: EIP712Struct 597 | 598 | -------------------------------------------------------------------------------- /modules/func.py: -------------------------------------------------------------------------------- 1 | from msoffcrypto.exceptions import DecryptionError, InvalidKeyError 2 | from loguru import logger 3 | from settings import EXCEL_PASSWORD, SHUFFLE_WALLETS 4 | from tqdm import tqdm 5 | from web3 import Web3 6 | from typing import Union 7 | from eth_typing import ChecksumAddress, HexStr 8 | from eth_account.datastructures import SignedMessage 9 | from rlp.sedes import big_endian_int, binary 10 | from rlp.sedes import List as rlpList 11 | from eth_utils import remove_0x_prefix 12 | from dataclasses import dataclass 13 | from modules.eip712struct import EIP712Struct, Address, Uint, Bytes, Array 14 | from typing import List, Optional 15 | from web3.types import AccessList, Nonce 16 | from hashlib import sha256 17 | from web3._utils.compat import TypedDict 18 | import msoffcrypto 19 | import pandas as pd 20 | import random 21 | import time 22 | import io 23 | import sys 24 | import rlp 25 | 26 | USDC = { 27 | 'name': 'USDC', 28 | 'decimal': 6, 29 | 'address': Web3.to_checksum_address('0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4'), 30 | } 31 | 32 | 33 | def to_bytes(data: Union[bytes, HexStr]) -> bytes: 34 | if isinstance(data, bytes): 35 | return data 36 | return bytes.fromhex(remove_0x_prefix(data)) 37 | 38 | 39 | def int_to_bytes(x: int) -> bytes: 40 | return x.to_bytes((x.bit_length() + 7) // 8, byteorder=sys.byteorder) 41 | 42 | 43 | def encode_address(addr: Union[Address, ChecksumAddress, str]) -> bytes: 44 | if len(addr) == 0: 45 | return bytes() 46 | if isinstance(addr, bytes): 47 | return addr 48 | return bytes.fromhex(remove_0x_prefix(addr)) 49 | 50 | 51 | def hash_byte_code(bytecode: bytes) -> bytes: 52 | bytecode_len = len(bytecode) 53 | bytecode_size = int(bytecode_len / 32) 54 | if bytecode_len % 32 != 0: 55 | raise RuntimeError("Bytecode length in 32-byte words must be odd") 56 | if bytecode_size > 2**16: 57 | raise OverflowError("hash_byte_code, bytecode length must be less than 2^16") 58 | bytecode_hash = sha256(bytecode).digest() 59 | encoded_len = bytecode_size.to_bytes(2, byteorder="big") 60 | ret = b"\x01\00" + encoded_len + bytecode_hash[4:] 61 | return ret 62 | 63 | 64 | DynamicBytes = Bytes(0) 65 | 66 | 67 | @dataclass 68 | class PaymasterParams(dict): 69 | paymaster: HexStr 70 | paymaster_input: bytes 71 | 72 | 73 | @dataclass 74 | class EIP712Meta: 75 | # GAS_PER_PUB_DATA_DEFAULT = 16 * 10000 76 | # GAS_PER_PUB_DATA_DEFAULT = 20 * 10000 77 | GAS_PER_PUB_DATA_DEFAULT = 50000 78 | 79 | gas_per_pub_data: int = GAS_PER_PUB_DATA_DEFAULT 80 | custom_signature: Optional[bytes] = None 81 | factory_deps: Optional[List[bytes]] = None 82 | paymaster_params: Optional[PaymasterParams] = None 83 | 84 | 85 | @dataclass 86 | class Transaction712: 87 | EIP_712_TX_TYPE = 113 88 | 89 | chain_id: int 90 | nonce: Nonce 91 | gas_limit: int 92 | to: Union[Address, ChecksumAddress, str] 93 | value: int 94 | data: Union[bytes, HexStr] 95 | maxPriorityFeePerGas: int 96 | maxFeePerGas: int 97 | from_: Union[bytes, HexStr] 98 | meta: EIP712Meta 99 | 100 | def encode(self, signature: Optional[SignedMessage] = None) -> bytes: 101 | factory_deps_data = [] 102 | factory_deps_elements = None 103 | factory_deps = self.meta.factory_deps 104 | if factory_deps is not None and len(factory_deps) > 0: 105 | factory_deps_data = factory_deps 106 | factory_deps_elements = [binary for _ in range(len(factory_deps_data))] 107 | 108 | paymaster_params_data = [] 109 | paymaster_params_elements = None 110 | paymaster_params = self.meta.paymaster_params 111 | if ( 112 | paymaster_params is not None 113 | and paymaster_params.paymaster is not None 114 | and paymaster_params.paymaster_input is not None 115 | ): 116 | paymaster_params_data = [ 117 | bytes.fromhex(remove_0x_prefix(paymaster_params.paymaster)), 118 | paymaster_params.paymaster_input, 119 | ] 120 | paymaster_params_elements = [binary, binary] 121 | 122 | class InternalRepresentation(rlp.Serializable): 123 | fields = [ 124 | ("nonce", big_endian_int), 125 | ("maxPriorityFeePerGas", big_endian_int), 126 | ("maxFeePerGas", big_endian_int), 127 | ("gasLimit", big_endian_int), 128 | ("to", binary), 129 | ("value", big_endian_int), 130 | ("data", binary), 131 | ("chain_id", big_endian_int), 132 | ("unknown1", binary), 133 | ("unknown2", binary), 134 | ("chain_id2", big_endian_int), 135 | ("from", binary), 136 | ("gasPerPubdata", big_endian_int), 137 | ("factoryDeps", rlpList(elements=factory_deps_elements, strict=False)), 138 | ("signature", binary), 139 | ( 140 | "paymaster_params", 141 | rlpList(elements=paymaster_params_elements, strict=True), 142 | ), 143 | ] 144 | 145 | custom_signature = self.meta.custom_signature 146 | if custom_signature is not None: 147 | rlp_signature = custom_signature 148 | elif signature is not None: 149 | rlp_signature = signature.signature 150 | else: 151 | raise RuntimeError("Custom signature and signature can't be None both") 152 | 153 | representation_params = { 154 | "nonce": self.nonce, 155 | "maxPriorityFeePerGas": self.maxPriorityFeePerGas, 156 | "maxFeePerGas": self.maxFeePerGas, 157 | "gasLimit": self.gas_limit, 158 | "to": encode_address(self.to), 159 | "value": self.value, 160 | "data": to_bytes(self.data), 161 | "chain_id": self.chain_id, 162 | "unknown1": b"", 163 | "unknown2": b"", 164 | "chain_id2": self.chain_id, 165 | "from": encode_address(self.from_), 166 | "gasPerPubdata": self.meta.gas_per_pub_data, 167 | "factoryDeps": factory_deps_data, 168 | "signature": rlp_signature, 169 | "paymaster_params": paymaster_params_data, 170 | } 171 | representation = InternalRepresentation(**representation_params) 172 | encoded_rlp = rlp.encode(representation, infer_serializer=True, cache=False) 173 | return int_to_bytes(self.EIP_712_TX_TYPE) + encoded_rlp 174 | 175 | def to_eip712_struct(self) -> EIP712Struct: 176 | class Transaction(EIP712Struct): 177 | pass 178 | 179 | paymaster: int = 0 180 | paymaster_params = self.meta.paymaster_params 181 | if paymaster_params is not None and paymaster_params.paymaster is not None: 182 | paymaster = int(paymaster_params.paymaster, 16) 183 | 184 | data = to_bytes(self.data) 185 | 186 | factory_deps = self.meta.factory_deps 187 | factory_deps_hashes = b"" 188 | if factory_deps is not None and len(factory_deps): 189 | factory_deps_hashes = tuple( 190 | [hash_byte_code(bytecode) for bytecode in factory_deps] 191 | ) 192 | 193 | setattr(Transaction, "txType", Uint(256)) 194 | setattr(Transaction, "from", Uint(256)) 195 | setattr(Transaction, "to", Uint(256)) 196 | setattr(Transaction, "gasLimit", Uint(256)) 197 | setattr(Transaction, "gasPerPubdataByteLimit", Uint(256)) 198 | setattr(Transaction, "maxFeePerGas", Uint(256)) 199 | setattr(Transaction, "maxPriorityFeePerGas", Uint(256)) 200 | setattr(Transaction, "paymaster", Uint(256)) 201 | setattr(Transaction, "nonce", Uint(256)) 202 | setattr(Transaction, "value", Uint(256)) 203 | setattr(Transaction, "data", DynamicBytes) 204 | setattr(Transaction, "factoryDeps", Array(Bytes(32))) 205 | setattr(Transaction, "paymasterInput", DynamicBytes) 206 | 207 | paymaster_input = b"" 208 | if ( 209 | paymaster_params is not None 210 | and paymaster_params.paymaster_input is not None 211 | ): 212 | paymaster_input = paymaster_params.paymaster_input 213 | 214 | kwargs = { 215 | "txType": self.EIP_712_TX_TYPE, 216 | "from": int(self.from_, 16), 217 | "to": int(self.to, 16), 218 | "gasLimit": self.gas_limit, 219 | "gasPerPubdataByteLimit": self.meta.gas_per_pub_data, 220 | "maxFeePerGas": self.maxFeePerGas, 221 | "maxPriorityFeePerGas": self.maxPriorityFeePerGas, 222 | "paymaster": paymaster, 223 | "nonce": self.nonce, 224 | "value": self.value, 225 | "data": data, 226 | "factoryDeps": factory_deps_hashes, 227 | "paymasterInput": paymaster_input, 228 | } 229 | return Transaction(**kwargs) 230 | 231 | 232 | Transaction = TypedDict( 233 | "Transaction", 234 | { 235 | "chain_id": int, 236 | "nonce": int, 237 | "from": HexStr, 238 | "to": HexStr, 239 | "gas": int, 240 | "gasPrice": int, 241 | "maxPriorityFeePerGas": int, 242 | "value": int, 243 | "data": HexStr, 244 | "transactionType": int, 245 | "accessList": Optional[AccessList], 246 | "eip712Meta": EIP712Meta, 247 | }, 248 | total=False, 249 | ) 250 | 251 | 252 | class TxBase: 253 | def __init__(self, trans: Transaction): 254 | self.tx_: Transaction = trans 255 | 256 | @property 257 | def tx(self) -> Transaction: 258 | return self.tx_ 259 | 260 | def tx712(self, estimated_gas: int) -> Transaction712: 261 | return Transaction712( 262 | chain_id=self.tx["chain_id"], 263 | nonce=Nonce(self.tx["nonce"]), 264 | gas_limit=estimated_gas, 265 | to=self.tx["to"], 266 | value=self.tx["value"], 267 | data=self.tx["data"], 268 | maxPriorityFeePerGas=self.tx["maxPriorityFeePerGas"], 269 | maxFeePerGas=self.tx["gasPrice"], 270 | from_=self.tx["from"], 271 | meta=self.tx["eip712Meta"], 272 | ) 273 | 274 | 275 | class TxFunctionCall(TxBase): 276 | def __init__( 277 | self, 278 | from_: HexStr, 279 | to: HexStr, 280 | value: int = 0, 281 | chain_id: int = None, 282 | nonce: int = None, 283 | data: HexStr = HexStr("0x"), 284 | gas_limit: int = 0, 285 | gas_price: int = 0, 286 | max_priority_fee_per_gas: int = 100_000_000, 287 | paymaster_params=None, 288 | custom_signature=None, 289 | gas_per_pub_data: int = EIP712Meta.GAS_PER_PUB_DATA_DEFAULT, 290 | ): 291 | eip712_meta = EIP712Meta( 292 | gas_per_pub_data=gas_per_pub_data, 293 | custom_signature=custom_signature, 294 | factory_deps=None, 295 | paymaster_params=paymaster_params, 296 | ) 297 | 298 | super(TxFunctionCall, self).__init__( 299 | trans={ 300 | "chain_id": chain_id, 301 | "nonce": nonce, 302 | "from": from_, 303 | "to": to, 304 | "gas": gas_limit, 305 | "gasPrice": gas_price, 306 | "maxPriorityFeePerGas": max_priority_fee_per_gas, 307 | "value": value, 308 | "data": data, 309 | "transactionType": 113, 310 | "eip712Meta": eip712_meta, 311 | } 312 | ) 313 | 314 | 315 | def shuffle(wallets_list): 316 | if SHUFFLE_WALLETS is True: 317 | numbered_wallets = list(enumerate(wallets_list, start=1)) 318 | random.shuffle(numbered_wallets) 319 | elif SHUFFLE_WALLETS is False: 320 | numbered_wallets = list(enumerate(wallets_list, start=1)) 321 | else: 322 | raise ValueError("\nНеверное значение переменной 'shuffle_wallets'. Ожидается 'True' or 'False'.") 323 | return numbered_wallets 324 | 325 | 326 | def sleeping(sleep_from: int, sleep_to: int): 327 | delay = random.randint(sleep_from, sleep_to) 328 | time.sleep(1) 329 | with tqdm( 330 | total=delay, 331 | desc="💤 Sleep", 332 | bar_format="{desc}: |{bar:20}| {percentage:.0f}% | {n_fmt}/{total_fmt}", 333 | colour="green" 334 | ) as pbar: 335 | for _ in range(delay): 336 | time.sleep(1) 337 | pbar.update(1) 338 | time.sleep(1) 339 | print() 340 | 341 | 342 | def get_accounts_data(): 343 | decrypted_data = io.BytesIO() 344 | with open('./data/accounts_data.xlsx', 'rb') as file: 345 | if EXCEL_PASSWORD: 346 | time.sleep(1) 347 | password = input('Enter the password: ') 348 | office_file = msoffcrypto.OfficeFile(file) 349 | 350 | try: 351 | office_file.load_key(password=password) 352 | except msoffcrypto.exceptions.DecryptionError: 353 | logger.info('\n⚠️ Incorrect password to decrypt Excel file! ⚠️\n') 354 | raise DecryptionError('Incorrect password') 355 | 356 | try: 357 | office_file.decrypt(decrypted_data) 358 | except msoffcrypto.exceptions.InvalidKeyError: 359 | logger.info('\n⚠️ Incorrect password to decrypt Excel file! ⚠️\n') 360 | raise InvalidKeyError('Incorrect password') 361 | 362 | except msoffcrypto.exceptions.DecryptionError: 363 | logger.info('\n⚠️ Set password on your Excel file first! ⚠️\n') 364 | raise DecryptionError('Excel without password') 365 | 366 | office_file.decrypt(decrypted_data) 367 | 368 | try: 369 | wb = pd.read_excel(decrypted_data) 370 | except ValueError as error: 371 | logger.info('\n⚠️ Wrong page name! ⚠️\n') 372 | raise ValueError(f"{error}") 373 | else: 374 | try: 375 | wb = pd.read_excel(file) 376 | except ValueError as error: 377 | logger.info('\n⚠️ Wrong page name! ⚠️\n') 378 | raise ValueError(f"{error}") 379 | 380 | accounts_data = {} 381 | for index, row in wb.iterrows(): 382 | private_key_evm = row["Private Key EVM"] 383 | accounts_data[int(index) + 1] = { 384 | "private_key_evm": private_key_evm, 385 | } 386 | 387 | priv_key_evm = [] 388 | for k, v in accounts_data.items(): 389 | priv_key_evm.append(v['private_key_evm']) 390 | return priv_key_evm 391 | -------------------------------------------------------------------------------- /modules/mute.py: -------------------------------------------------------------------------------- 1 | import random 2 | from web3 import Web3 3 | import json as js 4 | from settings import SLIPPAGE, VALUE_PRESCALE_SWAP 5 | from loguru import logger 6 | from modules.wallet import Wallet 7 | from modules.paymaster import PaymasterParams, PaymasterFlowEncoder 8 | from modules.func import TxFunctionCall, HexStr, sleeping 9 | from modules.retry import exception_handler 10 | import time 11 | 12 | TOKEN = [ 13 | { 14 | 'name': 'USDC', 15 | 'decimal': 6, 16 | 'address': Web3.to_checksum_address('0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4'), 17 | }, 18 | 19 | { 20 | 'name': 'USDT', 21 | 'decimal': 6, 22 | 'address': Web3.to_checksum_address('0x493257fd37edb34451f62edf8d2a0c418852ba4c'), 23 | } 24 | ] 25 | 26 | 27 | class Mute(Wallet): 28 | 29 | """ """ 30 | 31 | def __init__(self, private_key, number): 32 | super().__init__(private_key, number) 33 | self.address = Web3.to_checksum_address('0x8B791913eB07C32779a16750e3868aA8495F5964') 34 | self.abi = js.load(open('./abi/mute.txt')) 35 | self.contract = self.web3.eth.contract(address=self.address, abi=self.abi) 36 | 37 | self.paymaster_address = Web3.to_checksum_address('0x4ae2ba9a5c653038c6d2f5d9f80b28011a454597') 38 | 39 | def get_out_data(self, from_token_address: str, to_token_address: str, amount_in_wei: int): 40 | min_amount_out, stable_mode, fee = self.contract.functions.getAmountOut( 41 | amount_in_wei, 42 | from_token_address, 43 | to_token_address 44 | ).call() 45 | return int(min_amount_out - (min_amount_out / 100 * SLIPPAGE)), stable_mode, fee 46 | 47 | def approve(self, token_to_approve): 48 | token_contract = self.web3.eth.contract(token_to_approve['address'], abi=self.token_abi) 49 | max_amount = 2 ** 256 - 1 50 | dick = { 51 | 'from': self.address_wallet, 52 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 53 | **self.get_gas_price() 54 | } 55 | txn = token_contract.functions.approve(self.address, max_amount).build_transaction(dick) 56 | 57 | token_balance = self.get_token_balance(token_to_approve["address"]) 58 | if token_balance < self.to_wei(token_to_approve["decimal"], 2): 59 | self.send_transaction_and_wait(txn, f'Mute approve {token_to_approve["name"]}') 60 | else: 61 | paymaster_params = PaymasterParams(**{ 62 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 63 | "paymaster_input": self.web3.to_bytes(hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_approve['address'], 2**256-1, b'')) 64 | }) 65 | 66 | tx_func_call = TxFunctionCall( 67 | chain_id=self.web3.eth.chain_id, 68 | nonce=self.web3.eth.get_transaction_count(self.address_wallet), 69 | from_=self.address_wallet, 70 | to=token_to_approve['address'], 71 | data=HexStr(txn['data']), 72 | gas_limit=0, 73 | gas_price=self.web3.eth.gas_price, 74 | max_priority_fee_per_gas=0, 75 | gas_per_pub_data=50_000, 76 | paymaster_params=paymaster_params 77 | ) 78 | tx_712 = tx_func_call.tx712(txn['gas']) 79 | 80 | self.send_transaction_712_and_wait(tx_712, f'Paymaster Mute.io approve {token_to_approve["name"]}') 81 | 82 | @exception_handler(lable='Buy token Mute') 83 | def buy_token(self): 84 | token_to_buy = random.choice(TOKEN) 85 | logger.info(f'Buy {token_to_buy["name"]} token on MuteSwap') 86 | balance = self.get_native_balance() 87 | if balance < Web3.to_wei(0.0005, 'ether'): 88 | logger.error('Balance < 0.0005 ETH\n') 89 | return False 90 | 91 | prescale = random.uniform(VALUE_PRESCALE_SWAP[0], VALUE_PRESCALE_SWAP[1]) 92 | value_from_vei = round(Web3.from_wei(balance * prescale, 'ether'), VALUE_PRESCALE_SWAP[2]) 93 | amount_in_wei = Web3.to_wei(value_from_vei, 'ether') 94 | 95 | min_amount_out, stable_mode, _ = self.get_out_data(self.eth_address, token_to_buy['address'], amount_in_wei) 96 | 97 | txn = self.contract.functions.swapExactETHForTokens( 98 | min_amount_out, 99 | [self.eth_address, token_to_buy['address']], 100 | self.address_wallet, 101 | (int(time.time()) + 10000), 102 | [stable_mode] 103 | ).build_transaction({ 104 | 'from': self.address_wallet, 105 | 'value': amount_in_wei, 106 | 'gasPrice': self.web3.eth.gas_price, 107 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 108 | }) 109 | 110 | token_balance = self.get_token_balance(token_to_buy['address']) 111 | if token_balance < self.to_wei(token_to_buy['decimal'], 3): 112 | self.send_transaction_and_wait(txn, f'Buy {self.from_wei(token_to_buy["decimal"], min_amount_out)} {token_to_buy["name"]} on Mute.io') 113 | return token_to_buy 114 | else: 115 | paymaster_params = PaymasterParams(**{ 116 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 117 | "paymaster_input": self.web3.to_bytes(hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_buy["address"], 2**256-1, b'')) 118 | }) 119 | 120 | tx_func_call = TxFunctionCall( 121 | chain_id=self.web3.eth.chain_id, 122 | nonce=txn['nonce'], 123 | from_=self.address_wallet, 124 | to=txn['to'], 125 | value=txn['value'], 126 | data=HexStr(txn['data']), 127 | gas_limit=0, 128 | gas_price=self.web3.eth.gas_price, 129 | max_priority_fee_per_gas=0, 130 | gas_per_pub_data=50_000, 131 | paymaster_params=paymaster_params 132 | ) 133 | tx_712 = tx_func_call.tx712(txn['gas']) 134 | 135 | self.send_transaction_712_and_wait(tx_712, f'Paymaster buy {self.from_wei(token_to_buy["decimal"], min_amount_out)} {token_to_buy["name"]} Mute.io') 136 | return token_to_buy 137 | 138 | @exception_handler(lable='Sold token Mute') 139 | def sold_token(self, token_to_sold): 140 | 141 | token_contract = self.web3.eth.contract(token_to_sold['address'], abi=self.token_abi) 142 | allowance = token_contract.functions.allowance(self.address_wallet, self.address).call() 143 | if allowance < self.to_wei(token_to_sold["decimal"], 100000): 144 | self.approve(token_to_sold) 145 | sleeping(50, 70) 146 | 147 | balance_token = self.get_token_balance(token_to_sold['address']) - self.to_wei(token_to_sold['decimal'], 3) 148 | if balance_token <= 0: 149 | return logger.error(f'Token balance < 3 {token_to_sold["name"]}\n') 150 | 151 | min_amount_out, stable_mode, _ = self.get_out_data(token_to_sold['address'], self.eth_address, balance_token) 152 | 153 | txn = self.contract.functions.swapExactTokensForETH( 154 | balance_token, 155 | min_amount_out, 156 | [token_to_sold['address'], self.eth_address], 157 | self.address_wallet, 158 | (int(time.time()) + 10000), 159 | [stable_mode] 160 | ).build_transaction({ 161 | 'from': self.address_wallet, 162 | 'gasPrice': self.web3.eth.gas_price, 163 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 164 | }) 165 | 166 | paymaster_params = PaymasterParams(**{ 167 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 168 | "paymaster_input": self.web3.to_bytes(hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_sold['address'], 2**256-1, b'')) 169 | 170 | }) 171 | 172 | tx_func_call = TxFunctionCall( 173 | chain_id=self.web3.eth.chain_id, 174 | nonce=txn['nonce'], 175 | from_=self.address_wallet, 176 | to=txn['to'], 177 | data=HexStr(txn['data']), 178 | gas_limit=0, # Unknown at this state, estimation is done in next step 179 | gas_price=self.web3.eth.gas_price, 180 | max_priority_fee_per_gas=0, 181 | gas_per_pub_data=50_000, 182 | paymaster_params=paymaster_params 183 | ) 184 | tx_712 = tx_func_call.tx712(txn['gas']) 185 | 186 | self.send_transaction_712_and_wait(tx_712, f'Paymaster sold {self.from_wei(token_to_sold["decimal"], balance_token)} {token_to_sold["name"]} Mute.io') 187 | 188 | -------------------------------------------------------------------------------- /modules/paymaster.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from eth_typing import HexStr 3 | from web3 import Web3 4 | import json 5 | from enum import Enum 6 | from pathlib import Path 7 | from typing import Optional 8 | import importlib.resources as pkg_resources 9 | import contract_abi 10 | 11 | 12 | class JsonConfiguration(Enum): 13 | COMBINED = "combined" 14 | STANDARD = "standard" 15 | 16 | 17 | def paymaster_flow_abi_default(): 18 | global paymaster_flow_abi_cache 19 | 20 | if paymaster_flow_abi_cache is None: 21 | with pkg_resources.path(contract_abi, "IPaymasterFlow.json") as p: 22 | with p.open(mode="r") as json_file: 23 | data = json.load(json_file) 24 | paymaster_flow_abi_cache = data["abi"] 25 | return paymaster_flow_abi_cache 26 | 27 | 28 | class BaseContractEncoder: 29 | @classmethod 30 | def from_json( 31 | cls, 32 | web3: Web3, 33 | compiled_contract: Path, 34 | conf_type: JsonConfiguration = JsonConfiguration.COMBINED, 35 | ): 36 | with compiled_contract.open(mode="r") as json_f: 37 | data = json.load(json_f) 38 | if conf_type == JsonConfiguration.COMBINED: 39 | contracts = list() 40 | for contract_path, contract_data in data["contracts"].items(): 41 | # Check if 'abi' key exists 42 | if "abi" in contract_data and "bin" in contract_data: 43 | abi = contract_data["abi"] 44 | bin = contract_data["bin"] 45 | contracts.append(cls(web3, abi=abi, bytecode=bin)) 46 | 47 | return contracts 48 | else: 49 | return cls(web3, abi=data["abi"], bytecode=data["bytecode"]) 50 | 51 | def __init__(self, web3: Web3, abi, bytecode: Optional[bytes] = None): 52 | self.web3 = web3 53 | self.abi = abi 54 | if bytecode is None: 55 | self.instance_contract = self.web3.eth.contract(abi=self.abi) 56 | else: 57 | self.instance_contract = self.web3.eth.contract( 58 | abi=self.abi, bytecode=bytecode 59 | ) 60 | 61 | def encode_method(self, fn_name, args: tuple) -> HexStr: 62 | return self.instance_contract.encodeABI(fn_name, args) 63 | 64 | @property 65 | def contract(self): 66 | return self.instance_contract 67 | 68 | 69 | @dataclass 70 | class PaymasterParams(dict): 71 | paymaster: HexStr 72 | paymaster_input: bytes 73 | 74 | 75 | paymaster_flow_abi_cache = None 76 | 77 | 78 | class PaymasterFlowEncoder(BaseContractEncoder): 79 | def __init__(self, web3: Web3): 80 | super(PaymasterFlowEncoder, self).__init__( 81 | web3, abi=paymaster_flow_abi_default() 82 | ) 83 | 84 | def encode_approval_based( 85 | self, address: HexStr, min_allowance: int, inner_input: bytes 86 | ) -> HexStr: 87 | return self.encode_method( 88 | fn_name="approvalBased", args=(address, min_allowance, inner_input) 89 | ) 90 | 91 | def encode_general(self, inputs: bytes) -> HexStr: 92 | return self.encode_method(fn_name="general", args=tuple([inputs])) 93 | -------------------------------------------------------------------------------- /modules/retry.py: -------------------------------------------------------------------------------- 1 | from web3.exceptions import TransactionNotFound 2 | from web3.exceptions import ContractLogicError 3 | from loguru import logger 4 | from settings import RETRY, TIME_DELAY_ERROR, MAX_GAS_ETH, CHAIN_RPC 5 | from web3 import Web3 6 | from modules.func import sleeping 7 | import time 8 | 9 | web3_eth = Web3(Web3.HTTPProvider(CHAIN_RPC['Ethereum'], request_kwargs={'timeout': 60})) 10 | 11 | 12 | def chek_gas_eth(): 13 | while True: 14 | try: 15 | res = int(Web3.from_wei(web3_eth.eth.gas_price, 'gwei')) 16 | logger.info(f'GAS ETH - {res} GWEI\n') 17 | if res <= MAX_GAS_ETH: 18 | break 19 | else: 20 | time.sleep(60) 21 | continue 22 | except Exception as error: 23 | logger.error(error) 24 | time.sleep(30) 25 | continue 26 | 27 | 28 | def exception_handler(lable=''): 29 | def decorator(func): 30 | def wrapper(self, *args, **kwargs): 31 | for _ in range(RETRY): 32 | try: 33 | chek_gas_eth() 34 | return func(self, *args, **kwargs) 35 | 36 | except TransactionNotFound: 37 | logger.error('Транзакция не смайнилась за долгий промежуток времени, пытаюсь еще раз\n') 38 | self.send_message_error(self.number, lable, self.address_wallet, 'Транзакция не смайнилась за долгий промежуток времени, пытаюсь еще раз') 39 | sleeping(TIME_DELAY_ERROR[0], TIME_DELAY_ERROR[1]) 40 | 41 | except ConnectionError: 42 | logger.error('Ошибка подключения к интернету или проблемы с РПЦ\n') 43 | self.send_message_error(self.number, lable, self.address_wallet, 'Ошибка подключения к интернету или проблемы с РПЦ') 44 | sleeping(TIME_DELAY_ERROR[0], TIME_DELAY_ERROR[1]) 45 | 46 | except ContractLogicError as cle: 47 | if 'insufficien' in cle.args[0]: 48 | logger.error('Ошибка, скорее всего нехватает комсы\n') 49 | self.send_message_error(self.number, lable, self.address_wallet, 'Ошибка, скорее всего нехватает комсы') 50 | return 'balance' 51 | else: 52 | logger.error(f'{cle}' + '\n') 53 | self.send_message_error(self.number, lable, self.address_wallet, cle) 54 | sleeping(TIME_DELAY_ERROR[0], TIME_DELAY_ERROR[1]) 55 | 56 | except Exception as error: 57 | if isinstance(error.args[0], dict): 58 | if 'insufficien' in error.args[0]['message']: 59 | logger.error('Ошибка, скорее всего нехватает комсы\n') 60 | self.send_message_error(self.number, lable, self.address_wallet, 'Ошибка, скорее всего нехватает комсы') 61 | return 'balance' 62 | else: 63 | logger.error(f'{error}' + '\n') 64 | self.send_message_error(self.number, lable, self.address_wallet, error) 65 | sleeping(TIME_DELAY_ERROR[0], TIME_DELAY_ERROR[1]) 66 | else: 67 | logger.error(f'{error}' + '\n') 68 | self.send_message_error(self.number, lable, self.address_wallet, error) 69 | sleeping(TIME_DELAY_ERROR[0], TIME_DELAY_ERROR[1]) 70 | else: 71 | return False 72 | return wrapper 73 | return decorator 74 | -------------------------------------------------------------------------------- /modules/sign_messgae.py: -------------------------------------------------------------------------------- 1 | from eth_account.datastructures import SignedMessage 2 | from eth_account.signers.base import BaseAccount 3 | from eth_typing import ChecksumAddress, HexStr 4 | from eth_utils import keccak 5 | from eth_account.messages import encode_defunct, SignableMessage 6 | from abc import abstractmethod 7 | from modules.eip712struct import EIP712Struct, Address, Uint, Bytes, String 8 | import web3 9 | 10 | 11 | def make_domain( 12 | name=None, version=None, chainId=None, verifyingContract=None, salt=None 13 | ): 14 | """Helper method to create the standard EIP712Domain struct for you. 15 | 16 | Per the standard, if a value is not used then the parameter is omitted from the struct entirely. 17 | """ 18 | 19 | if all(i is None for i in [name, version, chainId, verifyingContract, salt]): 20 | raise ValueError("At least one argument must be given.") 21 | 22 | class EIP712Domain(EIP712Struct): 23 | pass 24 | 25 | kwargs = dict() 26 | if name is not None: 27 | EIP712Domain.name = String() 28 | kwargs["name"] = str(name) 29 | if version is not None: 30 | EIP712Domain.version = String() 31 | kwargs["version"] = str(version) 32 | if chainId is not None: 33 | EIP712Domain.chainId = Uint(256) 34 | kwargs["chainId"] = int(chainId) 35 | if verifyingContract is not None: 36 | EIP712Domain.verifyingContract = Address() 37 | kwargs["verifyingContract"] = verifyingContract 38 | if salt is not None: 39 | EIP712Domain.salt = Bytes(32) 40 | kwargs["salt"] = salt 41 | 42 | return EIP712Domain(**kwargs) 43 | 44 | 45 | class EthSignerBase: 46 | @abstractmethod 47 | def sign_typed_data(self, typed_data: EIP712Struct, domain=None) -> SignedMessage: 48 | raise NotImplemented 49 | 50 | @abstractmethod 51 | def verify_typed_data(self, sig: HexStr, typed_data: EIP712Struct) -> bool: 52 | raise NotImplemented 53 | 54 | 55 | class PrivateKeyEthSigner(EthSignerBase): 56 | _NAME = "zkSync" 57 | _VERSION = "2" 58 | 59 | def __init__(self, creds: BaseAccount, chain_id: int): 60 | self.credentials = creds 61 | self.chain_id = chain_id 62 | self.default_domain = make_domain( 63 | name=self._NAME, version=self._VERSION, chainId=self.chain_id 64 | ) 65 | 66 | @property 67 | def address(self) -> ChecksumAddress: 68 | return self.credentials.address 69 | 70 | @property 71 | def domain(self): 72 | return self.default_domain 73 | 74 | def typed_data_to_signed_bytes( 75 | self, typed_data: EIP712Struct, domain=None 76 | ) -> SignableMessage: 77 | d = domain 78 | if d is None: 79 | d = self.domain 80 | msg = typed_data.signable_bytes(d) 81 | return encode_defunct(msg) 82 | 83 | def sign_typed_data(self, typed_data: EIP712Struct, domain=None) -> SignedMessage: 84 | singable_message = self.typed_data_to_signed_bytes(typed_data, domain) 85 | msg_hash = keccak(singable_message.body) 86 | return self.credentials.signHash(msg_hash) 87 | 88 | def verify_typed_data( 89 | self, sig: HexStr, typed_data: EIP712Struct, domain=None 90 | ) -> bool: 91 | singable_message = self.typed_data_to_signed_bytes(typed_data, domain) 92 | msg_hash = keccak(singable_message.body) 93 | address = web3.Account._recover_hash(message_hash=msg_hash, signature=sig) 94 | return address.lower() == self.address.lower() 95 | -------------------------------------------------------------------------------- /modules/syncswap.py: -------------------------------------------------------------------------------- 1 | import random 2 | from web3 import Web3 3 | from eth_abi import abi 4 | import json as js 5 | import time 6 | from settings import SLIPPAGE, VALUE_PRESCALE_SWAP 7 | from loguru import logger 8 | from modules.wallet import Wallet 9 | from modules.paymaster import PaymasterParams, PaymasterFlowEncoder 10 | from modules.func import TxFunctionCall, HexStr, sleeping 11 | from modules.retry import exception_handler 12 | 13 | TOKEN = [ 14 | { 15 | 'name': 'USDC', 16 | 'decimal': 6, 17 | 'address': Web3.to_checksum_address('0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4') 18 | }, 19 | 20 | { 21 | 'name': 'USDT', 22 | 'decimal': 6, 23 | 'address': Web3.to_checksum_address('0x493257fd37edb34451f62edf8d2a0c418852ba4c'), 24 | }, 25 | 26 | { 27 | 'name': 'DAI', 28 | 'decimal': 18, 29 | 'address': Web3.to_checksum_address('0x4B9eb6c0b6ea15176BBF62841C6B2A8a398cb656'), 30 | }, 31 | ] 32 | 33 | 34 | class SynkSwap(Wallet): 35 | 36 | """ """ 37 | 38 | def __init__(self, private_key, number): 39 | super().__init__(private_key, number) 40 | self.classic_pool_address = Web3.to_checksum_address('0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb') 41 | self.classic_pool_factory_abi = js.load(open('./abi/classic_pool_factory_syncswap.txt')) 42 | self.classic_pool_contract = self.web3.eth.contract(address=self.classic_pool_address, abi=self.classic_pool_factory_abi) 43 | 44 | self.router_address = Web3.to_checksum_address('0x9B5def958d0f3b6955cBEa4D5B7809b2fb26b059') 45 | self.router_abi = js.load(open('./abi/router_syncswap.txt')) 46 | self.router_contract = self.web3.eth.contract(address=self.router_address, abi=self.router_abi) 47 | 48 | self.paymaster_address = Web3.to_checksum_address('0x0c08f298A75A090DC4C0BB4CaA4204B8B9D156c1') 49 | self.classic_pool_abi = js.load(open('./abi/classic_pool_syncswap.txt')) 50 | 51 | def get_min_amount_out(self, pool_address, token_address, amount): 52 | pool_contract = self.web3.eth.contract(address=pool_address, abi=self.classic_pool_abi) 53 | min_amount_out = pool_contract.functions.getAmountOut( 54 | token_address, 55 | amount, 56 | self.address_wallet 57 | ).call() 58 | return int(min_amount_out - (min_amount_out // 100 * SLIPPAGE)) 59 | 60 | def approve(self, token_to_approve): 61 | token_contract = self.web3.eth.contract(token_to_approve['address'], abi=self.token_abi) 62 | max_amount = 2 ** 256 - 1 63 | dick = { 64 | 'from': self.address_wallet, 65 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 66 | **self.get_gas_price() 67 | } 68 | txn = token_contract.functions.approve(self.router_address, max_amount).build_transaction(dick) 69 | 70 | token_balance = self.get_token_balance(token_to_approve["address"]) 71 | if token_balance < self.to_wei(token_to_approve["decimal"], 2): 72 | self.send_transaction_and_wait(txn, f'Syncswap approve {token_to_approve["name"]}') 73 | else: 74 | min_allowance = self.to_wei(token_to_approve["decimal"], 2000) 75 | inner_input = Web3.to_bytes(abi.encode(['uint64'], [0])) 76 | 77 | paymaster_params = PaymasterParams(**{ 78 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 79 | "paymaster_input": self.web3.to_bytes(hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_approve['address'], min_allowance, inner_input)) 80 | }) 81 | 82 | tx_func_call = TxFunctionCall( 83 | chain_id=self.web3.eth.chain_id, 84 | nonce=self.web3.eth.get_transaction_count(self.address_wallet), 85 | from_=self.address_wallet, 86 | to=token_to_approve['address'], 87 | data=HexStr(txn['data']), 88 | gas_limit=0, 89 | gas_price=self.web3.eth.gas_price, 90 | max_priority_fee_per_gas=0, 91 | gas_per_pub_data=50_000, 92 | paymaster_params=paymaster_params 93 | ) 94 | tx_712 = tx_func_call.tx712(txn['gas']) 95 | 96 | self.send_transaction_712_and_wait(tx_712, f'Paymaster Syncswap approve {token_to_approve["name"]}') 97 | 98 | @exception_handler() 99 | def buy_token(self): 100 | balance = self.get_native_balance() 101 | if balance < Web3.to_wei(0.0005, 'ether'): 102 | logger.error('Balance < 0.0005 ETH\n') 103 | return False 104 | 105 | token_to_buy = random.choice(TOKEN) 106 | 107 | prescale = random.uniform(VALUE_PRESCALE_SWAP[0], VALUE_PRESCALE_SWAP[1]) 108 | value_from_vei = round(Web3.from_wei(balance * prescale, 'ether'), VALUE_PRESCALE_SWAP[2]) 109 | amount_in_wei = Web3.to_wei(value_from_vei, 'ether') 110 | 111 | pool_address = self.classic_pool_contract.functions.getPool(self.eth_address, token_to_buy['address']).call() 112 | 113 | min_amount_out = self.get_min_amount_out(pool_address, self.eth_address, amount_in_wei) 114 | 115 | swap_data = abi.encode(['address', 'address', 'uint8'], [self.eth_address, self.address_wallet, 1]) 116 | steps = [ 117 | pool_address, 118 | Web3.to_hex(swap_data), 119 | self.zero_address, 120 | '0x', 121 | True, 122 | ] 123 | 124 | paths = [ 125 | [steps], 126 | self.zero_address, 127 | amount_in_wei 128 | ] 129 | deadline = int(time.time()) + 1800 130 | txn = self.router_contract.functions.swap( 131 | [paths], 132 | min_amount_out, 133 | deadline, 134 | ).build_transaction({ 135 | 'from': self.address_wallet, 136 | 'value': amount_in_wei, 137 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 138 | **self.get_gas_price() 139 | }) 140 | 141 | token_balance = self.get_token_balance(token_to_buy['address']) 142 | if token_balance < self.to_wei(token_to_buy['decimal'], 3): 143 | self.send_transaction_and_wait(txn, f'Buy {self.from_wei(token_to_buy["decimal"], min_amount_out)} {token_to_buy["name"]} on Syncswap') 144 | return token_to_buy 145 | else: 146 | min_allowance = self.to_wei(token_to_buy["decimal"], 2000) 147 | inner_input = Web3.to_bytes(abi.encode(['uint64'], [0])) 148 | 149 | paymaster_params = PaymasterParams(**{ 150 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 151 | "paymaster_input": self.web3.to_bytes( 152 | hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_buy['address'], min_allowance, inner_input)) 153 | }) 154 | 155 | tx_func_call = TxFunctionCall( 156 | chain_id=self.web3.eth.chain_id, 157 | nonce=txn['nonce'], 158 | from_=self.address_wallet, 159 | to=txn['to'], 160 | value=txn['value'], 161 | data=HexStr(txn['data']), 162 | gas_limit=0, 163 | gas_price=self.web3.eth.gas_price, 164 | max_priority_fee_per_gas=0, 165 | gas_per_pub_data=50_000, 166 | paymaster_params=paymaster_params 167 | ) 168 | tx_712 = tx_func_call.tx712(txn['gas']) 169 | 170 | self.send_transaction_712_and_wait(tx_712, f'Paymaster buy {self.from_wei(token_to_buy["decimal"], min_amount_out)} {token_to_buy["name"]} Syncswap') 171 | return token_to_buy 172 | 173 | @exception_handler() 174 | def sold_token(self, token_to_sold): 175 | token_contract = self.web3.eth.contract(token_to_sold['address'], abi=self.token_abi) 176 | allowance = token_contract.functions.allowance(self.address_wallet, self.router_address).call() 177 | if allowance < self.to_wei(token_to_sold["decimal"], 100000): 178 | self.approve(token_to_sold) 179 | sleeping(50, 70) 180 | 181 | balance_token = self.get_token_balance(token_to_sold['address']) - self.to_wei(token_to_sold['decimal'], 3) 182 | if balance_token <= 0: 183 | return logger.error(f'Token balance < 3 {token_to_sold["name"]}\n') 184 | 185 | pool_address = self.classic_pool_contract.functions.getPool(token_to_sold['address'], self.eth_address).call() 186 | 187 | min_amount_out = self.get_min_amount_out(pool_address, token_to_sold['address'], balance_token) 188 | 189 | swap_data = abi.encode(['address', 'address', 'uint8'], [token_to_sold['address'], self.address_wallet, 1]) 190 | steps = [ 191 | pool_address, 192 | Web3.to_hex(swap_data), 193 | self.zero_address, 194 | '0x', 195 | True, 196 | ] 197 | 198 | paths = [ 199 | [steps], 200 | token_to_sold['address'], 201 | balance_token 202 | ] 203 | deadline = int(time.time()) + 1800 204 | txn = self.router_contract.functions.swap( 205 | [paths], 206 | min_amount_out, 207 | deadline, 208 | ).build_transaction({ 209 | 'from': self.address_wallet, 210 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 211 | **self.get_gas_price() 212 | }) 213 | 214 | min_allowance = self.to_wei(token_to_sold['decimal'], 2000) 215 | inner_input = Web3.to_bytes(abi.encode(['uint64'], [0])) 216 | 217 | paymaster_params = PaymasterParams(**{ 218 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 219 | "paymaster_input": self.web3.to_bytes( 220 | hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_sold['address'], min_allowance, inner_input)) 221 | }) 222 | 223 | tx_func_call = TxFunctionCall( 224 | chain_id=self.web3.eth.chain_id, 225 | nonce=txn['nonce'], 226 | from_=self.address_wallet, 227 | to=txn['to'], 228 | data=HexStr(txn['data']), 229 | gas_limit=0, # Unknown at this state, estimation is done in next step 230 | gas_price=self.web3.eth.gas_price, 231 | max_priority_fee_per_gas=0, 232 | gas_per_pub_data=50_000, 233 | paymaster_params=paymaster_params 234 | ) 235 | tx_712 = tx_func_call.tx712(txn['gas']) 236 | 237 | self.send_transaction_712_and_wait(tx_712, f'Paymaster sold {self.from_wei(token_to_sold["decimal"], balance_token)} {token_to_sold["name"]} Syncswap') 238 | -------------------------------------------------------------------------------- /modules/tg_bot.py: -------------------------------------------------------------------------------- 1 | from settings import TG_ID, TG_TOKEN, TG_BOT_SEND 2 | import requests 3 | import json 4 | 5 | 6 | class TgBot: 7 | 8 | @staticmethod 9 | def send_message(text): 10 | url = f"https://api.telegram.org/bot{TG_TOKEN}/sendMessage" 11 | params = { 12 | 'chat_id': TG_ID, 13 | 'text': text, 14 | 'link_preview_options': json.dumps({'is_disabled': True}), 15 | 'parse_mode': 'HTML' 16 | } 17 | requests.get(url=url, data=params) 18 | 19 | def send_message_success(self, number, text, address, link): 20 | if TG_BOT_SEND is True: 21 | try: 22 | str_send = f'[{number}]\n✅ {text}\nАккаунт: {address}\nTx hash' 23 | 24 | self.send_message(str_send) 25 | except Exception as error: 26 | print(error) 27 | 28 | def send_message_error(self, number, text, address, errorr): 29 | if TG_BOT_SEND is True: 30 | try: 31 | str_send = f'[{number}]\n❌ {text}\nАккаунт: {address}\n{errorr}' 32 | self.send_message(str_send) 33 | except Exception as error: 34 | print(error) 35 | -------------------------------------------------------------------------------- /modules/velocore.py: -------------------------------------------------------------------------------- 1 | import random 2 | from web3 import Web3 3 | from eth_abi import abi 4 | import json as js 5 | from eth_utils import to_bytes, to_hex 6 | from settings import SLIPPAGE, VALUE_PRESCALE_SWAP 7 | from loguru import logger 8 | from modules.wallet import Wallet 9 | from modules.paymaster import PaymasterParams, PaymasterFlowEncoder 10 | from modules.func import TxFunctionCall, HexStr, sleeping 11 | from modules.retry import exception_handler 12 | 13 | TOKEN = [ 14 | { 15 | 'name': 'USDC', 16 | 'decimal': 6, 17 | 'address': Web3.to_checksum_address('0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4'), 18 | 'pool': Web3.to_checksum_address('0x42D106c4A1d0Bc5C482c11853A3868d807A3781d') 19 | }, 20 | 21 | { 22 | 'name': 'USDT', 23 | 'decimal': 6, 24 | 'address': Web3.to_checksum_address('0x493257fd37edb34451f62edf8d2a0c418852ba4c'), 25 | 'pool': Web3.to_checksum_address('0xF0e86a60Ae7e9bC0F1e59cAf3CC56f434b3024c0') 26 | } 27 | 28 | # { 29 | # 'name': 'DAI', 30 | # 'decimal': 18, 31 | # 'address': Web3.to_checksum_address('0x4B9eb6c0b6ea15176BBF62841C6B2A8a398cb656'), 32 | # 'pool': Web3.to_checksum_address('0x8eB36AE0CD568A884DAD95433b63f8A5db7682a7') 33 | # }, 34 | ] 35 | 36 | 37 | class Velocore(Wallet): 38 | 39 | """ """ 40 | 41 | def __init__(self, private_key, number): 42 | super().__init__(private_key, number) 43 | self.multicall_address = Web3.to_checksum_address('0xF9cda624FBC7e059355ce98a31693d299FACd963') 44 | self.multicall_abi = js.load(open('./abi/velocore_multicall.txt')) 45 | self.multicall_contract = self.web3.eth.contract(address=self.multicall_address, abi=self.multicall_abi) 46 | 47 | self.router_address = Web3.to_checksum_address('0xf5E67261CB357eDb6C7719fEFAFaaB280cB5E2A6') 48 | self.router_abi = js.load(open('./abi/velocore_router.txt')) 49 | self.router_contract = self.web3.eth.contract(address=self.router_address, abi=self.router_abi) 50 | 51 | self.paymaster_address = Web3.to_checksum_address('0x443F985fd3484b9FDC7B5df58c9A0FAdbe449b92') 52 | 53 | @staticmethod 54 | def to_token_info(token_ref_index: int, method: int, min_amount_out:int = 0) -> str: 55 | encode_amount = 2 ** 127 - 1 - min_amount_out 56 | return to_bytes(token_ref_index) + to_bytes(method) + abi.encode(['uint128'], [encode_amount])[2:] 57 | 58 | def get_min_amount_out(self, from_token_address, to_token_address, reverse_flag, pool_address, amounts): 59 | at_most = 1 60 | _all = 2 61 | eth_mask = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' 62 | 63 | data = self.multicall_contract.functions.aggregate3( 64 | [ 65 | ( 66 | self.router_address, 67 | True, 68 | to_bytes(hexstr=self.router_contract.encodeABI( 69 | fn_name='query', 70 | args=( 71 | self.address_wallet, 72 | [ 73 | abi.encode(['address'], [to_token_address if reverse_flag else from_token_address]), 74 | eth_mask, 75 | ], 76 | amounts, 77 | [ 78 | [ 79 | abi.encode(['address'], [pool_address]), 80 | [ 81 | self.to_token_info(0x00, at_most if reverse_flag else _all), 82 | self.to_token_info(0x01, _all if reverse_flag else at_most), 83 | ], 84 | '0x00' 85 | ] 86 | ] 87 | ) 88 | ) 89 | ) 90 | ) 91 | ] 92 | ).call() 93 | hex_data = to_hex(data[0][1]) 94 | token_amount_hex = hex_data[-128:-64] if reverse_flag else hex_data[-64:] 95 | 96 | min_amount_out = int(token_amount_hex, 16) 97 | 98 | return int(min_amount_out - (min_amount_out / 100 * SLIPPAGE)) 99 | 100 | def approve(self, token_to_approve): 101 | token_contract = self.web3.eth.contract(token_to_approve['address'], abi=self.token_abi) 102 | max_amount = 2 ** 256 - 1 103 | dick = { 104 | 'from': self.address_wallet, 105 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 106 | **self.get_gas_price() 107 | } 108 | txn = token_contract.functions.approve(self.router_address, max_amount).build_transaction(dick) 109 | 110 | token_balance = self.get_token_balance(token_to_approve["address"]) 111 | if token_balance < self.to_wei(token_to_approve["decimal"], 2): 112 | self.send_transaction_and_wait(txn, f'Velocore approve {token_to_approve["name"]}') 113 | else: 114 | if token_to_approve['name'] == 'DAI': 115 | min_allowance = 696493865665783254 116 | else: 117 | min_allowance = 1436595 118 | paymaster_params = PaymasterParams(**{ 119 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 120 | "paymaster_input": self.web3.to_bytes(hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_approve['address'], min_allowance, b'')) 121 | }) 122 | 123 | tx_func_call = TxFunctionCall( 124 | chain_id=self.web3.eth.chain_id, 125 | nonce=self.web3.eth.get_transaction_count(self.address_wallet), 126 | from_=self.address_wallet, 127 | to=token_to_approve['address'], 128 | data=HexStr(txn['data']), 129 | gas_limit=0, 130 | gas_price=self.web3.eth.gas_price, 131 | max_priority_fee_per_gas=0, 132 | gas_per_pub_data=50_000, 133 | paymaster_params=paymaster_params 134 | ) 135 | tx_712 = tx_func_call.tx712(txn['gas']) 136 | 137 | self.send_transaction_712_and_wait(tx_712, f'Paymaster Velocore approve {token_to_approve["name"]}') 138 | 139 | @exception_handler() 140 | def buy_token(self): 141 | balance = self.get_native_balance() 142 | if balance < Web3.to_wei(0.0005, 'ether'): 143 | logger.error('Balance < 0.0005 ETH\n') 144 | return False 145 | 146 | eth_mask = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' 147 | token_to_buy = random.choice(TOKEN) 148 | at_most = 1 149 | _all = 2 150 | to_index_id = 0x00 151 | reverse_flag = True 152 | 153 | prescale = random.uniform(VALUE_PRESCALE_SWAP[0], VALUE_PRESCALE_SWAP[1]) 154 | value_from_vei = round(Web3.from_wei(balance * prescale, 'ether'), VALUE_PRESCALE_SWAP[2]) 155 | amount_in_wei = Web3.to_wei(value_from_vei, 'ether') 156 | 157 | min_amount_out = self.get_min_amount_out(eth_mask, token_to_buy['address'], reverse_flag, token_to_buy['pool'], [0, amount_in_wei]) 158 | 159 | txn = self.router_contract.functions.execute( 160 | [ 161 | abi.encode(['address'], [token_to_buy['address']]), 162 | eth_mask, 163 | ], 164 | [ 165 | 0, 166 | 0 167 | ], 168 | [ 169 | [ 170 | abi.encode(['address'], [token_to_buy['pool']]), 171 | [ 172 | self.to_token_info(0x00, at_most if reverse_flag else _all), 173 | self.to_token_info(0x01, _all if reverse_flag else at_most), 174 | ], 175 | '0x00' 176 | ], 177 | [ 178 | "0x0500000000000000000000000000000000000000000000000000000000000000", 179 | [ 180 | self.to_token_info(to_index_id, at_most, min_amount_out), 181 | ], 182 | '0x00' 183 | ] 184 | ] 185 | ).build_transaction({ 186 | 'from': self.address_wallet, 187 | 'value': amount_in_wei, 188 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 189 | **self.get_gas_price() 190 | }) 191 | 192 | token_balance = self.get_token_balance(token_to_buy['address']) 193 | if token_balance < self.to_wei(token_to_buy['decimal'], 3): 194 | self.send_transaction_and_wait(txn, f'Buy {self.from_wei(token_to_buy["decimal"], min_amount_out)} {token_to_buy["name"]} on Velocore') 195 | return token_to_buy 196 | else: 197 | 198 | if token_to_buy['name'] == 'DAI': 199 | min_allowance = 696493865665783254 200 | else: 201 | min_allowance = 1436595 202 | paymaster_params = PaymasterParams(**{ 203 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 204 | "paymaster_input": self.web3.to_bytes(hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_buy["address"], min_allowance, b'')) 205 | }) 206 | 207 | tx_func_call = TxFunctionCall( 208 | chain_id=self.web3.eth.chain_id, 209 | nonce=txn['nonce'], 210 | from_=self.address_wallet, 211 | to=txn['to'], 212 | value=txn['value'], 213 | data=HexStr(txn['data']), 214 | gas_limit=0, 215 | gas_price=self.web3.eth.gas_price, 216 | max_priority_fee_per_gas=0, 217 | gas_per_pub_data=50_000, 218 | paymaster_params=paymaster_params 219 | ) 220 | tx_712 = tx_func_call.tx712(txn['gas']) 221 | 222 | self.send_transaction_712_and_wait(tx_712, f'Paymaster buy {self.from_wei(token_to_buy["decimal"], min_amount_out)} {token_to_buy["name"]} Velocore') 223 | return token_to_buy 224 | 225 | @exception_handler() 226 | def sold_token(self, token_to_sold): 227 | token_contract = self.web3.eth.contract(token_to_sold['address'], abi=self.token_abi) 228 | allowance = token_contract.functions.allowance(self.address_wallet, self.router_address).call() 229 | if allowance < self.to_wei(token_to_sold["decimal"], 100000): 230 | self.approve(token_to_sold) 231 | sleeping(50, 70) 232 | 233 | balance_token = self.get_token_balance(token_to_sold['address']) - self.to_wei(token_to_sold['decimal'], 3) 234 | if balance_token <= 0: 235 | return logger.error(f'Token balance < 3 {token_to_sold["name"]}\n') 236 | 237 | eth_mask = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' 238 | at_most = 1 239 | _all = 2 240 | to_index_id = 0x01 241 | reverse_flag = False 242 | 243 | min_amount_out = self.get_min_amount_out(token_to_sold['address'], eth_mask, reverse_flag, token_to_sold['pool'], [balance_token, 0]) 244 | 245 | txn = self.router_contract.functions.execute( 246 | [ 247 | abi.encode(['address'], [token_to_sold['address']]), 248 | eth_mask, 249 | ], 250 | [ 251 | balance_token, 252 | 0 253 | ], 254 | [ 255 | [ 256 | abi.encode(['address'], [token_to_sold['pool']]), 257 | [ 258 | self.to_token_info(0x00, at_most if reverse_flag else _all), 259 | self.to_token_info(0x01, _all if reverse_flag else at_most), 260 | ], 261 | '0x00' 262 | ], 263 | [ 264 | "0x0500000000000000000000000000000000000000000000000000000000000000", 265 | [ 266 | self.to_token_info(to_index_id, at_most, min_amount_out), 267 | ], 268 | '0x00' 269 | ] 270 | ] 271 | ).build_transaction({ 272 | 'from': self.address_wallet, 273 | 'nonce': self.web3.eth.get_transaction_count(self.address_wallet), 274 | **self.get_gas_price() 275 | }) 276 | 277 | if token_to_sold['name'] == 'DAI': 278 | min_allowance = 696493865665783254 279 | else: 280 | min_allowance = 1436595 281 | 282 | paymaster_params = PaymasterParams(**{ 283 | "paymaster": Web3.to_checksum_address(self.paymaster_address), 284 | "paymaster_input": self.web3.to_bytes(hexstr=PaymasterFlowEncoder(self.web3).encode_approval_based(token_to_sold['address'], min_allowance, b'')) 285 | 286 | }) 287 | 288 | tx_func_call = TxFunctionCall( 289 | chain_id=self.web3.eth.chain_id, 290 | nonce=txn['nonce'], 291 | from_=self.address_wallet, 292 | to=txn['to'], 293 | data=HexStr(txn['data']), 294 | gas_limit=0, # Unknown at this state, estimation is done in next step 295 | gas_price=self.web3.eth.gas_price, 296 | max_priority_fee_per_gas=0, 297 | gas_per_pub_data=50_000, 298 | paymaster_params=paymaster_params 299 | ) 300 | tx_712 = tx_func_call.tx712(txn['gas']) 301 | 302 | self.send_transaction_712_and_wait(tx_712, f'Paymaster sold {self.from_wei(token_to_sold["decimal"], balance_token)} {token_to_sold["name"]} Velocore') 303 | -------------------------------------------------------------------------------- /modules/wallet.py: -------------------------------------------------------------------------------- 1 | from requests.adapters import Retry 2 | import requests 3 | from loguru import logger 4 | from web3 import Web3 5 | from settings import CHAIN_RPC 6 | import time 7 | import json as js 8 | from modules.sign_messgae import PrivateKeyEthSigner 9 | from modules.tg_bot import TgBot 10 | 11 | 12 | class Wallet(TgBot): 13 | 14 | def __init__(self, private_key, number): 15 | self.private_key = private_key 16 | self.number = number 17 | self.web3 = self.get_web3() 18 | self.account = self.web3.eth.account.from_key(private_key) 19 | self.address_wallet = self.account.address 20 | self.token_abi = js.load(open('./abi/token.txt')) 21 | self.eth_address = Web3.to_checksum_address('0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91') 22 | self.zero_address = '0x0000000000000000000000000000000000000000' 23 | 24 | @staticmethod 25 | def get_web3(): 26 | retries = Retry(total=10, backoff_factor=1, status_forcelist=[500, 502, 503, 504]) 27 | adapter = requests.adapters.HTTPAdapter(max_retries=retries) 28 | session = requests.Session() 29 | session.mount('http://', adapter) 30 | session.mount('https://', adapter) 31 | return Web3(Web3.HTTPProvider(CHAIN_RPC['ZkSync'], request_kwargs={'timeout': 60}, session=session)) 32 | 33 | @staticmethod 34 | def to_wei(decimal, amount): 35 | if decimal == 6: 36 | unit = 'picoether' 37 | else: 38 | unit = 'ether' 39 | 40 | return Web3.to_wei(amount, unit) 41 | 42 | @staticmethod 43 | def from_wei(decimal, amount): 44 | if decimal == 6: 45 | unit = 'picoether' 46 | elif decimal == 8: 47 | return float(amount / 10 ** 8) 48 | else: 49 | unit = 'ether' 50 | 51 | return Web3.from_wei(amount, unit) 52 | 53 | def send_transaction_and_wait(self, tx, message): 54 | 55 | signed_txn = self.web3.eth.account.sign_transaction(tx, private_key=self.private_key) 56 | tx_hash = self.web3.eth.send_raw_transaction(signed_txn.rawTransaction) 57 | logger.info('Sent a transaction') 58 | time.sleep(5) 59 | tx_receipt = self.web3.eth.wait_for_transaction_receipt(tx_hash, timeout=900, poll_latency=5) 60 | if tx_receipt.status == 1: 61 | logger.success('The transaction was successfully mined') 62 | else: 63 | logger.error("Transaction failed, I'm trying again") 64 | self.send_message_error(self.number, message, self.address_wallet, "Transaction failed, I'm trying again") 65 | raise ValueError('') 66 | 67 | self.send_message_success(self.number, message, self.address_wallet, f'https://era.zksync.network/tx/{tx_hash.hex()}') 68 | logger.success(f'[{self.number}] {message} || https://era.zksync.network/tx/{tx_hash.hex()}\n') 69 | return tx_hash 70 | 71 | def get_native_balance(self): 72 | return self.web3.eth.get_balance(self.address_wallet) 73 | 74 | def get_token_balance(self, token_address): 75 | token_contract = self.web3.eth.contract(address=token_address, abi=self.token_abi) 76 | return token_contract.functions.balanceOf(self.address_wallet).call() 77 | 78 | def get_gas_price(self): 79 | return {'maxFeePerGas': self.web3.eth.gas_price, 'maxPriorityFeePerGas': 0} 80 | 81 | def check_allowance(self, address, token): 82 | token_contract = self.web3.eth.contract(address=Web3.to_checksum_address(token), abi=self.token_abi) 83 | return token_contract.functions.allowance(self.address_wallet, Web3.to_checksum_address(address)).call() 84 | 85 | def send_transaction_712_and_wait(self, tx_712, message): 86 | signer = PrivateKeyEthSigner(self.account, 324) 87 | signed_message = signer.sign_typed_data(tx_712.to_eip712_struct()) 88 | msg = tx_712.encode(signed_message) 89 | tx_hash = self.web3.eth.send_raw_transaction(msg) 90 | logger.info('Sent a transaction') 91 | time.sleep(5) 92 | tx_receipt = self.web3.eth.wait_for_transaction_receipt(tx_hash, timeout=900, poll_latency=5) 93 | if tx_receipt.status == 1: 94 | logger.success('The transaction was successfully mined') 95 | else: 96 | logger.error("Transaction failed, I'm trying again") 97 | self.send_message_error(self.number, message, self.address_wallet, "Transaction failed, I'm trying again") 98 | raise ValueError('') 99 | 100 | self.send_message_success(self.number, message, self.address_wallet, f'https://era.zksync.network/tx/{tx_hash.hex()}') 101 | logger.success(f'[{self.number}] {message} || https://era.zksync.network/tx/{tx_hash.hex()}\n') 102 | return tx_hash 103 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.31.0 2 | loguru==0.7.2 3 | web3==6.15.1 4 | ccxt==4.2.44 5 | pandas==2.2.0 6 | rlp==4.0.0 7 | tqdm==4.66.2 8 | msoffcrypto-tool==5.1.1 9 | openpyxl==3.1.2 -------------------------------------------------------------------------------- /settings.py: -------------------------------------------------------------------------------- 1 | EXCEL_PASSWORD = False # Если ставите пароль на Excel с приватниками || True/ False 2 | SHUFFLE_WALLETS = False # Перемешка кошельков || True/ False 3 | 4 | TG_BOT_SEND = False # Включить уведомления в тг или нет || True/ False 5 | TG_TOKEN = '' # API токен тг-бота - создать его можно здесь - https://t.me/BotFather 6 | TG_ID = 0 # id твоего телеграмма можно узнать тут - https://t.me/getmyid_bot 7 | 8 | CHAIN_RPC = { 9 | 'ZkSync' : 'https://mainnet.era.zksync.io', 10 | 'Ethereum': 'https://rpc.ankr.com/eth', 11 | } 12 | 13 | MAX_GAS_ETH = 100 # gas в gwei (смотреть здесь : https://etherscan.io/gastracker) 14 | 15 | RETRY = 5 # Количество попыток при ошибках / фейлах 16 | TIME_DELAY = [200, 250] # Задержка между МОДУЛЯМИ [min, max] 17 | TIME_ACCOUNT_DELAY = [200, 300] # Задержка между АККАУНТАМИ [min, max] 18 | TIME_DELAY_ERROR = [10, 20] # Задержка при ошибках / фейлах [min, max] 19 | 20 | 21 | VALUE_PRESCALE_SWAP = [0.2, 0.3, 5] # Процент от баланса [min, max, round_decimal] 22 | SLIPPAGE = 1 # % 23 | 24 | NUMBER_TRANS = [1, 2] # Количество кругов ( Круг = Купил + продал ) 25 | 26 | 27 | 28 | --------------------------------------------------------------------------------