Skip to content

Commit 1555929

Browse files
committed
update
1 parent 616dd61 commit 1555929

27 files changed

+1267
-484
lines changed

main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from config import ACCOUNTS, PROXIES
99
from utils.get_proxy import check_proxy
1010
from utils.sleeping import sleep
11-
from utils.gas_checker import check_gas
12-
from settings import *
11+
from settings import USE_PROXY, RANDOM_WALLET, IS_SLEEP, SLEEP_FROM, SLEEP_TO
12+
from modules_settings import *
1313

1414

1515
def get_module():
@@ -93,7 +93,6 @@ def get_wallets():
9393
return wallets
9494

9595

96-
@check_gas
9796
def run_module(module, account_id, key, proxy):
9897
module(account_id, key, proxy)
9998

modules/basilisk.py

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from loguru import logger
55
from web3 import Web3
66
from config import BASILISK_CONTRACTS, BASILISK_ABI
7+
from utils.gas_checker import check_gas
8+
from utils.helpers import retry
79
from utils.sleeping import sleep
810
from .account import Account
911

@@ -24,6 +26,8 @@ def get_deposit_amount(self):
2426
amount = self.contract.functions.balanceOfUnderlying(self.address).call()
2527
return amount
2628

29+
@retry
30+
@check_gas
2731
def deposit(
2832
self,
2933
min_amount: float,
@@ -46,82 +50,76 @@ def deposit(
4650
max_percent
4751
)
4852

49-
try:
50-
logger.info(f"[{self.account_id}][{self.address}] Make deposit on Basilisk | {amount} ETH")
53+
logger.info(f"[{self.account_id}][{self.address}] Make deposit on Basilisk | {amount} ETH")
5154

52-
self.tx.update({"value": amount_wei})
55+
self.tx.update({"value": amount_wei})
5356

54-
transaction = self.contract.functions.mint().build_transaction(self.tx)
57+
transaction = self.contract.functions.mint().build_transaction(self.tx)
5558

56-
signed_txn = self.sign(transaction)
59+
signed_txn = self.sign(transaction)
5760

58-
txn_hash = self.send_raw_transaction(signed_txn)
61+
txn_hash = self.send_raw_transaction(signed_txn)
5962

60-
self.wait_until_tx_finished(txn_hash.hex())
63+
self.wait_until_tx_finished(txn_hash.hex())
6164

62-
if make_withdraw:
63-
sleep(sleep_from, sleep_to)
65+
if make_withdraw:
66+
sleep(sleep_from, sleep_to)
6467

65-
self.withdraw()
66-
except Exception as e:
67-
logger.error(f"[{self.account_id}][{self.address}] Error | {e}")
68+
self.withdraw()
6869

70+
@retry
71+
@check_gas
6972
def withdraw(self):
7073
amount = self.get_deposit_amount()
7174

7275
if amount > 0:
73-
try:
74-
logger.info(
75-
f"[{self.account_id}][{self.address}] Make withdraw from Basilisk | " +
76-
f"{Web3.from_wei(amount, 'ether')} ETH"
77-
)
76+
logger.info(
77+
f"[{self.account_id}][{self.address}] Make withdraw from Basilisk | " +
78+
f"{Web3.from_wei(amount, 'ether')} ETH"
79+
)
7880

79-
self.tx.update({"value": 0, "nonce": self.w3.eth.get_transaction_count(self.address)})
81+
self.tx.update({"value": 0, "nonce": self.w3.eth.get_transaction_count(self.address)})
8082

81-
transaction = self.contract.functions.redeemUnderlying(amount).build_transaction(self.tx)
83+
transaction = self.contract.functions.redeemUnderlying(amount).build_transaction(self.tx)
8284

83-
signed_txn = self.sign(transaction)
85+
signed_txn = self.sign(transaction)
8486

85-
txn_hash = self.send_raw_transaction(signed_txn)
87+
txn_hash = self.send_raw_transaction(signed_txn)
8688

87-
self.wait_until_tx_finished(txn_hash.hex())
88-
except Exception as e:
89-
logger.error(f"[{self.account_id}][{self.address}] Error | {e}")
89+
self.wait_until_tx_finished(txn_hash.hex())
9090
else:
9191
logger.error(f"[{self.account_id}][{self.address}] Deposit not found")
9292

93+
@retry
94+
@check_gas
9395
def enable_collateral(self):
9496
logger.info(f"[{self.account_id}][{self.address}] Enable collateral on Basilisk")
9597

9698
contract = self.get_contract(BASILISK_CONTRACTS["collateral"], BASILISK_ABI)
9799

98-
try:
99-
transaction = contract.functions.enterMarkets(
100-
[Web3.to_checksum_address(BASILISK_CONTRACTS["landing"])]
101-
).build_transaction(self.tx)
100+
transaction = contract.functions.enterMarkets(
101+
[Web3.to_checksum_address(BASILISK_CONTRACTS["landing"])]
102+
).build_transaction(self.tx)
102103

103-
signed_txn = self.sign(transaction)
104+
signed_txn = self.sign(transaction)
104105

105-
txn_hash = self.send_raw_transaction(signed_txn)
106+
txn_hash = self.send_raw_transaction(signed_txn)
106107

107-
self.wait_until_tx_finished(txn_hash.hex())
108-
except Exception as e:
109-
logger.error(f"[{self.account_id}][{self.address}] Error | {e}")
108+
self.wait_until_tx_finished(txn_hash.hex())
110109

110+
@retry
111+
@check_gas
111112
def disable_collateral(self):
112113
logger.info(f"[{self.account_id}][{self.address}] Disable collateral on Basilisk")
113114

114115
contract = self.get_contract(BASILISK_CONTRACTS["collateral"], BASILISK_ABI)
115116

116-
try:
117-
transaction = contract.functions.exitMarket(
118-
Web3.to_checksum_address(BASILISK_CONTRACTS["landing"])
119-
).build_transaction(self.tx)
117+
transaction = contract.functions.exitMarket(
118+
Web3.to_checksum_address(BASILISK_CONTRACTS["landing"])
119+
).build_transaction(self.tx)
120120

121-
signed_txn = self.sign(transaction)
121+
signed_txn = self.sign(transaction)
122122

123-
txn_hash = self.send_raw_transaction(signed_txn)
123+
txn_hash = self.send_raw_transaction(signed_txn)
124124

125-
self.wait_until_tx_finished(txn_hash.hex())
126-
except Exception as e:
127-
logger.error(f"[{self.account_id}][{self.address}] Error | {e}")
125+
self.wait_until_tx_finished(txn_hash.hex())

modules/bungee.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from loguru import logger
55
from web3 import Web3
66
from config import BUNGEE_ABI, BUNGEE_CONTRACT
7+
from utils.gas_checker import check_gas
8+
from utils.helpers import retry
79
from .account import Account
810
from utils.bungee_data import get_bungee_data
911

@@ -45,38 +47,37 @@ def get_tx_data(self, amount: int):
4547
}
4648
return tx
4749

50+
@retry
51+
@check_gas
4852
def refuel(self, chain_list: list, random_amount: bool):
4953
limits = get_bungee_limits()
5054

5155
to_chain = random.choice(chain_list)
5256

53-
try:
54-
to_chain_limits = [
55-
chain for chain in limits if chain["chainId"] == self.chain_ids[to_chain] and chain["isEnabled"]
56-
]
57+
to_chain_limits = [
58+
chain for chain in limits if chain["chainId"] == self.chain_ids[to_chain] and chain["isEnabled"]
59+
]
5760

58-
if to_chain_limits:
59-
min_amount = int(to_chain_limits[0]["minAmount"])
60-
max_amount = int(to_chain_limits[0]["maxAmount"])
61+
if to_chain_limits:
62+
min_amount = int(to_chain_limits[0]["minAmount"])
63+
max_amount = int(to_chain_limits[0]["maxAmount"])
6164

62-
amount = random.randint(min_amount, max_amount) if random_amount else min_amount
65+
amount = random.randint(min_amount, max_amount) if random_amount else min_amount
6366

64-
logger.info(
65-
f"[{self.account_id}][{self.address}] Make refuel to " +
66-
f"{to_chain.title()} | {Web3.from_wei(amount, 'ether')} ETH"
67-
)
67+
logger.info(
68+
f"[{self.account_id}][{self.address}] Make refuel to " +
69+
f"{to_chain.title()} | {Web3.from_wei(amount, 'ether')} ETH"
70+
)
6871

69-
transaction = self.contract.functions.depositNativeToken(
70-
self.chain_ids[to_chain],
71-
self.address
72-
).build_transaction(self.get_tx_data(amount))
72+
transaction = self.contract.functions.depositNativeToken(
73+
self.chain_ids[to_chain],
74+
self.address
75+
).build_transaction(self.get_tx_data(amount))
7376

74-
signed_txn = self.sign(transaction)
77+
signed_txn = self.sign(transaction)
7578

76-
txn_hash = self.send_raw_transaction(signed_txn)
79+
txn_hash = self.send_raw_transaction(signed_txn)
7780

78-
self.wait_until_tx_finished(txn_hash.hex())
79-
else:
80-
logger.error(f"[{self.account_id}][{self.address}] Bungee refuel destination chain inactive!")
81-
except Exception as e:
82-
logger.error(f"[{self.account_id}][{self.address}] Bungee refuel error | error {e}")
81+
self.wait_until_tx_finished(txn_hash.hex())
82+
else:
83+
logger.error(f"[{self.account_id}][{self.address}] Bungee refuel destination chain inactive!")

modules/dmail.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from loguru import logger
55
from web3 import Web3
66
from config import DMAIL_ABI, DMAIL_CONTRACT
7+
from utils.gas_checker import check_gas
8+
from utils.helpers import retry
79
from .account import Account
810

911

@@ -28,21 +30,19 @@ def get_random_email():
2830

2931
return domain_address + random.choice(domain_list)
3032

33+
@retry
34+
@check_gas
3135
def send_mail(self, random_receiver: bool):
3236
logger.info(f"[{self.account_id}][{self.address}] Send email")
3337

3438
email_address = self.get_random_email() if random_receiver else f"{self.address}@dmail.ai"
3539

36-
try:
37-
data = self.contract.encodeABI("send_mail", args=(email_address, email_address))
40+
data = self.contract.encodeABI("send_mail", args=(email_address, email_address))
3841

39-
self.tx.update({"data": data})
42+
self.tx.update({"data": data})
4043

41-
signed_txn = self.sign(self.tx)
44+
signed_txn = self.sign(self.tx)
4245

43-
txn_hash = self.send_raw_transaction(signed_txn)
44-
45-
self.wait_until_tx_finished(txn_hash.hex())
46-
except Exception as e:
47-
logger.error(f"[{self.account_id}][{self.address}] Error | {e}")
46+
txn_hash = self.send_raw_transaction(signed_txn)
4847

48+
self.wait_until_tx_finished(txn_hash.hex())

modules/era_domain.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from loguru import logger
55
from web3 import Web3
66
from config import ENS_CONTRACT, ENS_ABI
7+
from utils.gas_checker import check_gas
8+
from utils.helpers import retry
79
from .account import Account
810

911

@@ -33,20 +35,19 @@ def get_random_name(self):
3335

3436
self.get_random_name()
3537

38+
@retry
39+
@check_gas
3640
def mint(self):
3741
logger.info(f"[{self.account_id}][{self.address}] Mint Era Domain")
3842

3943
domain_name = self.get_random_name()
4044

41-
try:
42-
self.tx.update({"value": Web3.to_wei(0.003, "ether")})
45+
self.tx.update({"value": Web3.to_wei(0.003, "ether")})
4346

44-
transaction = self.contract.functions.Register(domain_name).build_transaction(self.tx)
47+
transaction = self.contract.functions.Register(domain_name).build_transaction(self.tx)
4548

46-
signed_txn = self.sign(transaction)
49+
signed_txn = self.sign(transaction)
4750

48-
txn_hash = self.send_raw_transaction(signed_txn)
51+
txn_hash = self.send_raw_transaction(signed_txn)
4952

50-
self.wait_until_tx_finished(txn_hash.hex())
51-
except Exception as e:
52-
logger.error(f"[{self.account_id}][{self.address}] Error | {e}")
53+
self.wait_until_tx_finished(txn_hash.hex())

0 commit comments

Comments
 (0)