Skip to content

Commit 77d59c2

Browse files
committed
feat: make ID optional, randomly generate one if not provided
1 parent 24929c5 commit 77d59c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/degenbot/arbitrage/uniswap_lp_cycle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import math
3+
import uuid
34
from collections.abc import Iterable, Mapping, Sequence
45
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
56
from dataclasses import dataclass
@@ -9,6 +10,7 @@
910

1011
import eth_abi.abi
1112
from eth_typing import ChecksumAddress, HexStr
13+
from hexbytes import HexBytes
1214
from scipy.optimize import OptimizeResult, minimize_scalar
1315
from web3 import Web3
1416

@@ -74,7 +76,7 @@ def __init__(
7476
self,
7577
input_token: Erc20Token,
7678
swap_pools: Iterable[Pool],
77-
id: str, # noqa:A002
79+
id: str | None, # noqa:A002
7880
max_input: int | None = None,
7981
) -> None:
8082
for swap_pool in swap_pools:
@@ -86,7 +88,7 @@ def __init__(
8688
if len(set(self.swap_pools)) != len(self.swap_pools):
8789
raise DegenbotValueError(message="Swap pools must not contain duplicates.")
8890

89-
self.id = id
91+
self.id = HexBytes(uuid.uuid4().bytes).to_0x_hex() if id is None else id
9092
self.input_token = input_token
9193

9294
if max_input is None:

0 commit comments

Comments
 (0)