Skip to content

Commit

Permalink
Service files and config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
smeshny committed Nov 28, 2024
1 parent a0ab93e commit 0e2bc03
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 15 deletions.
60 changes: 53 additions & 7 deletions config.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion modules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .interfaces import DEX, RequestClient, Bridge, Refuel, Messenger, Landing, Minter, Blockchain, Creator, CEX, Logger
from .client import Client
from .custom_modules import Custom
from .blockchains import ZkSync, Base, Scroll, Linea, ArbitrumNova, Zora, Ethereum, Blast, SimpleEVM, PolygonZkEVM
from .blockchains import ZkSync, Base, Scroll, Linea, ArbitrumNova, Zora, Ethereum, Blast, SimpleEVM, PolygonZkEVM, Unichain
from .swaps import Izumi
from .swaps import Maverick
from .swaps import Mute
Expand Down Expand Up @@ -34,6 +34,8 @@
from .bridges import Bungee
from .bridges import Nitro
from .bridges import NativeBridge
from .bridges import TestnetBridge
from .bridges import SuperbridgeBridgeGG
from .onmichain import L2Telegraph
from .onmichain import Merkly
from .onmichain import Zerius
Expand Down
1 change: 1 addition & 0 deletions modules/blockchains/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .evm import ZkSync, Scroll, Base, Linea, ArbitrumNova, Zora, Ethereum, Blast, SimpleEVM, PolygonZkEVM
from .unichain import Unichain
8 changes: 4 additions & 4 deletions modules/blockchains/evm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SimpleEVM(Logger):
def __init__(self, client):
self.client = client
Logger.__init__(self)

self.chain_for_logger = self.client.network.name
self.network = self.client.network.name
self.token_contract = self.client.get_contract(TOKENS_PER_CHAIN[self.network][f'W{self.client.network.token}'],
WETH_ABI)
Expand Down Expand Up @@ -66,9 +66,9 @@ async def transfer_eth(self):
amount = await self.client.get_smart_amount(TRANSFER_AMOUNT)
amount_in_wei = self.client.to_wei(amount)

if amount > 0.0001:
raise SoftwareExceptionWithoutRetry(
'Are you sure about transferring more than 0.0001ETH to a random address?')
# if amount > 0.0001:
# raise SoftwareExceptionWithoutRetry(
# 'Are you sure about transferring more than 0.0001ETH to a random address?')

random_address = Account.create().address

Expand Down
2 changes: 2 additions & 0 deletions modules/bridges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
from .bungee import Bungee
from .nitro import Nitro
from .native import NativeBridge
from .testnetbridge import TestnetBridge
from .superbridge_bridge_gg import SuperbridgeBridgeGG
4 changes: 3 additions & 1 deletion modules/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ async def check_for_approved(

async def send_transaction(
self, transaction=None, need_hash: bool = False, without_gas: bool = False, poll_latency: int = 10,
timeout: int = 360, tx_hash=None, send_mode: bool = False, signed_tx=None
timeout: int = 360, tx_hash=None, send_mode: bool = False, signed_tx=None, need_receipt: bool = True,
) -> bool | HexStr:
try:
if not without_gas and not tx_hash and not send_mode:
Expand Down Expand Up @@ -558,6 +558,8 @@ async def send_transaction(
self.logger_msg(*self.acc_info, msg=message, type_msg='success')
if need_hash:
return tx_hash
if need_receipt:
return receipts
return True
elif status is None:
await asyncio.sleep(poll_latency)
Expand Down
6 changes: 4 additions & 2 deletions modules/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ def __init__(self):
self.logger.add(stderr, format=logger_format)
date = datetime.today().date()
self.logger.add(f"./data/logs/{date}.log", rotation="500 MB", level="INFO", format=logger_format)
self.chain_for_logger = None
self.class_name_for_logger = None

def logger_msg(self, account_name, address, msg, type_msg: str = 'info'):
from config import ACCOUNT_NAMES
class_name = self.__class__.__name__
software_chain = CHAIN_NAME[GLOBAL_NETWORK]
class_name = self.__class__.__name__ if not self.class_name_for_logger else self.class_name_for_logger
software_chain = CHAIN_NAME[GLOBAL_NETWORK] if not self.chain_for_logger else self.chain_for_logger
acc_index = '1/1'
if account_name:
account_index = ACCOUNT_NAMES.index(account_name) + 1
Expand Down
24 changes: 24 additions & 0 deletions utils/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,3 +664,27 @@ def __repr__(self):
# token='ETH',
# explorer='https://zkscan.io/'
# )

ETH_SepoliaRPC = Network(
name='ETH Sepolia',
rpc=[
'https://ethereum-sepolia-rpc.publicnode.com',
'https://sepolia.drpc.org',
'https://eth-sepolia.public.blastapi.io',
],
chain_id=11155111,
eip1559_support=True,
token='ETH',
explorer='https://sepolia.etherscan.io/'
)

Unichain_SepoliaRPC = Network(
name='Unichain Sepolia',
rpc=[
'https://sepolia.unichain.org/'
],
chain_id=1301,
eip1559_support=True,
token='ETH',
explorer='https://sepolia.uniscan.xyz/'
)

0 comments on commit 0e2bc03

Please sign in to comment.