web3-wizzard-lib 1.12.5__py3-none-any.whl → 1.13.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- web3_wizzard_lib/core/modules/nft_minter.py +2 -2
- web3_wizzard_lib/core/modules/swap/metamusk.py +63 -0
- web3_wizzard_lib/resources/main/contracts.json +4 -2
- web3_wizzard_lib/resources/main/networks.json +2 -2
- {web3_wizzard_lib-1.12.5.dist-info → web3_wizzard_lib-1.13.1.dist-info}/METADATA +2 -2
- {web3_wizzard_lib-1.12.5.dist-info → web3_wizzard_lib-1.13.1.dist-info}/RECORD +8 -7
- {web3_wizzard_lib-1.12.5.dist-info → web3_wizzard_lib-1.13.1.dist-info}/WHEEL +0 -0
- {web3_wizzard_lib-1.12.5.dist-info → web3_wizzard_lib-1.13.1.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@ import random
|
|
2
2
|
|
3
3
|
from loguru import logger
|
4
4
|
from sybil_engine.data.contracts import get_contracts_for_chain
|
5
|
-
from sybil_engine.data.networks import get_chain_instance
|
5
|
+
from sybil_engine.data.networks import get_chain_instance
|
6
6
|
from sybil_engine.module.module import RepeatableModule, Order
|
7
7
|
from sybil_engine.utils.package_import_utils import import_all_modules_in_directory, get_all_subclasses
|
8
8
|
from sybil_engine.utils.scan_utils import find_interacted_contracts
|
@@ -95,7 +95,7 @@ class NFTMinter(RepeatableModule):
|
|
95
95
|
if self.retry_counter < self.retries:
|
96
96
|
self.retry_counter = self.retry_counter + 1
|
97
97
|
logger.info(f"{self.retry_counter} retries from {self.retries}")
|
98
|
-
set_rpc_for_chain('LINEA')
|
98
|
+
#set_rpc_for_chain('LINEA')
|
99
99
|
randomized_sleeping({'from': 1, 'to': 60})
|
100
100
|
raise RetryException(e)
|
101
101
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import random
|
2
|
+
|
3
|
+
import requests
|
4
|
+
from loguru import logger
|
5
|
+
from sybil_engine.contract.send import Send
|
6
|
+
|
7
|
+
from sybil_engine.domain.dex import Dex
|
8
|
+
from sybil_engine.utils.retry import retry
|
9
|
+
|
10
|
+
|
11
|
+
class MetamuskSwap(Dex):
|
12
|
+
dex_name = 'metamusk'
|
13
|
+
swap_contract = 'METAMUSK'
|
14
|
+
supported_chains = ['ETH_MAINNET', 'BASE']
|
15
|
+
|
16
|
+
def __init__(self, chain_instance, web3):
|
17
|
+
super().__init__(chain_instance, web3)
|
18
|
+
self.send = Send(None, self.web3)
|
19
|
+
self.metamusk_router_address = self.chain_contracts[self.swap_contract]
|
20
|
+
|
21
|
+
@retry(max_attempts=10, retry_interval={'from': 10, 'to': 20})
|
22
|
+
def swap(self, amount_to_swap, from_token, to_token, slippage, account):
|
23
|
+
logger.info(
|
24
|
+
f"Swap {amount_to_swap.log_line()}->{to_token.symbol()} in {self.dex_name} ({self.chain_instance['chain']})")
|
25
|
+
|
26
|
+
if amount_to_swap.token == 'ETH':
|
27
|
+
from_token_address = '0x0000000000000000000000000000000000000000'
|
28
|
+
else:
|
29
|
+
if from_token.allowance(account, self.metamusk_router_address) < amount_to_swap.wei:
|
30
|
+
from_token.approve(account, self.metamusk_router_address)
|
31
|
+
|
32
|
+
from_token_address = from_token.erc20_contract.contract_address
|
33
|
+
|
34
|
+
if to_token.token == 'ETH':
|
35
|
+
to_token_address = '0x0000000000000000000000000000000000000000'
|
36
|
+
else:
|
37
|
+
to_token_address = to_token.erc20_contract.contract_address
|
38
|
+
|
39
|
+
data = self.get_trade_data(account, amount_to_swap.wei, from_token_address, to_token_address)
|
40
|
+
|
41
|
+
self.send.send_to_wallet(account, self.metamusk_router_address, amount_to_swap, data)
|
42
|
+
|
43
|
+
def get_trade_data(self, account, amount_to_swap_wei, from_token_address, to_token_address):
|
44
|
+
response = requests.get(
|
45
|
+
"https://bridge.api.cx.metamask.io/getQuote",
|
46
|
+
params={
|
47
|
+
"walletAddress": account.address,
|
48
|
+
"destWalletAddress": account.address,
|
49
|
+
"srcChainId": self.chain_instance['chain_id'],
|
50
|
+
"destChainId": self.chain_instance['chain_id'],
|
51
|
+
"srcTokenAddress": from_token_address,
|
52
|
+
"destTokenAddress": to_token_address,
|
53
|
+
"srcTokenAmount": amount_to_swap_wei,
|
54
|
+
"insufficientBal": True,
|
55
|
+
"resetApproval": False,
|
56
|
+
"gasIncluded": True,
|
57
|
+
"slippage": 2
|
58
|
+
}
|
59
|
+
)
|
60
|
+
|
61
|
+
choice = random.choice(response.json())
|
62
|
+
data = choice['trade']['data']
|
63
|
+
return data
|
@@ -1,7 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"ETH_MAINNET": {
|
3
3
|
"SCROLL_BRIDGE": "0x6774Bcbd5ceCeF1336b5300fb5186a12DDD8b367",
|
4
|
-
"SCROLL_ORACLE": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B"
|
4
|
+
"SCROLL_ORACLE": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",
|
5
|
+
"METAMUSK": "0x881D40237659C251811CEC9c364ef91dC08D300C"
|
5
6
|
},
|
6
7
|
"ZKSYNC": {
|
7
8
|
"MAV_ROUTER": "0x39E098A153Ad69834a9Dac32f0FCa92066aD03f4",
|
@@ -58,7 +59,8 @@
|
|
58
59
|
"MERKLY": "0x6bf98654205B1AC38645880Ae20fc00B0bB9FFCA",
|
59
60
|
"DMAIL": "0x47fbe95e981C0Df9737B6971B451fB15fdC989d9",
|
60
61
|
"LAYER2_20": "0x0a88BC5c32b684D467b43C06D9e0899EfEAF59Df",
|
61
|
-
"STARGATE_V2": "0xdc181Bd607330aeeBEF6ea62e03e5e1Fb4B6F7C7"
|
62
|
+
"STARGATE_V2": "0xdc181Bd607330aeeBEF6ea62e03e5e1Fb4B6F7C7",
|
63
|
+
"METAMUSK": "0x9dDA6Ef3D919c9bC8885D5560999A3640431e8e6"
|
62
64
|
},
|
63
65
|
"LINEA": {
|
64
66
|
"WOOFI": "0x4c4AF8DBc524681930a27b2F1Af5bcC8062E6fB7",
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"gas_token": "ETH",
|
4
4
|
"poa": false,
|
5
5
|
"eip1599": false,
|
6
|
-
"rpc": "https://
|
6
|
+
"rpc": "https://eth.llamarpc.com",
|
7
7
|
"scan": "https://etherscan.io/",
|
8
8
|
"api_scan": "https://api.etherscan.io/",
|
9
9
|
"transaction_sleep_interval": {
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"BASE": {
|
32
32
|
"gas_token": "ETH",
|
33
33
|
"poa": false,
|
34
|
-
"eip1599":
|
34
|
+
"eip1599": false,
|
35
35
|
"stargate_usdc_pool": 1,
|
36
36
|
"stargate_eth_pool": 13,
|
37
37
|
"stargate_chain_id": 184,
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: web3-wizzard-lib
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.13.1
|
4
4
|
Summary: Engine for web3 smart contracts automatization.
|
5
5
|
Author-email: Indeoo <indeooars@gmail.com>
|
6
6
|
License: MIT
|
7
7
|
Project-URL: Homepage, https://github.com/Indeoo/web3-wizzard-lib/
|
8
8
|
Requires-Python: >=3.7
|
9
9
|
Description-Content-Type: text/markdown
|
10
|
-
Requires-Dist: sybil-engine==10.
|
10
|
+
Requires-Dist: sybil-engine==10.6.1
|
11
11
|
Requires-Dist: brotli==1.1.0
|
@@ -114,7 +114,7 @@ web3_wizzard_lib/core/modules/linea_poh_lxp.py,sha256=kVVtd5gkcEdyYc3YSRlECgPmDs
|
|
114
114
|
web3_wizzard_lib/core/modules/liquidity_pool.py,sha256=vu0vBoXomvAJFa10n9woo66v62hQbEO726M4lkiLWNE,2181
|
115
115
|
web3_wizzard_lib/core/modules/merkly_refuel.py,sha256=whQD6CplGt-hQxFN7lg40F6SmFU5niOO529lKMj0dyA,3488
|
116
116
|
web3_wizzard_lib/core/modules/new_rage_withdraw.py,sha256=e4VSaQYgBBi6WZbU6HJr_q4LTzyBURMnXANVJqRagdY,1450
|
117
|
-
web3_wizzard_lib/core/modules/nft_minter.py,sha256=
|
117
|
+
web3_wizzard_lib/core/modules/nft_minter.py,sha256=YPCN-hCbk74zqPuuefLDDjR1hxmz98mdsMDT_--IPLk,4147
|
118
118
|
web3_wizzard_lib/core/modules/orbiter.py,sha256=Y_1xX7QkRdju9wXo-RKgeIoNwPJYIqrhxPK6uC5TaHU,1400
|
119
119
|
web3_wizzard_lib/core/modules/orbiter_checker.py,sha256=Zo3r2S986sz5srcKTz2g6vpwv9i3YVOJSGkQEvE7ul8,666
|
120
120
|
web3_wizzard_lib/core/modules/rage.py,sha256=uIJiUGbXxGkKuusaLH3ndsYIzm3ze3KcLw7nZsMkBoU,1979
|
@@ -248,6 +248,7 @@ web3_wizzard_lib/core/modules/swap/horizondex.py,sha256=GKn4CjNt85P_xUmdK5mZzfTk
|
|
248
248
|
web3_wizzard_lib/core/modules/swap/izumi.py,sha256=j9jUsaENyoz1Tldao0h5lSMcQtxwxktc4PVfscq09Wc,1730
|
249
249
|
web3_wizzard_lib/core/modules/swap/lineaswap.py,sha256=2Br3ELyLktZx6BZh9O0qWm2VaHbJuXQDK0LY_75QC5s,1625
|
250
250
|
web3_wizzard_lib/core/modules/swap/maverick.py,sha256=tn0mVaoJxxWgDpTLXxhSv5Kf0b0cZcRRuZtjqIm1aKo,3080
|
251
|
+
web3_wizzard_lib/core/modules/swap/metamusk.py,sha256=q_7lBenrWHKps6lARScycF-19Er-KOnT5Y4UFvgzxZs,2484
|
251
252
|
web3_wizzard_lib/core/modules/swap/mute.py,sha256=uwyuNVAqUxWruL19mE3U6ccLU15_E-6TajlGpd58uLo,1973
|
252
253
|
web3_wizzard_lib/core/modules/swap/odos.py,sha256=c9vaWo1WyUap9CgzLQhXWKnylEMocm5kqMBm0_ZEGuk,2281
|
253
254
|
web3_wizzard_lib/core/modules/swap/one_inch.py,sha256=VHc36z6CvfUYD2nZxk1jj1COPAFp3p6uJmiyIOjjrVU,2513
|
@@ -366,13 +367,13 @@ web3_wizzard_lib/resources/local/contracts.json,sha256=vZFZ4gBj7mKEBCDtQQNt5GV6H
|
|
366
367
|
web3_wizzard_lib/resources/local/networks.json,sha256=NFJ2SWQvoUJ0LoR2e0hNLsDcnNEgilbgqpvovwzla-E,2559
|
367
368
|
web3_wizzard_lib/resources/local/pairs.json,sha256=Tr4UCWMBioCDzX9g5jvTtVNnlzXlh98JBFi5aGDeXxY,7252
|
368
369
|
web3_wizzard_lib/resources/local/tokens.json,sha256=oWlx18Zn_BSo1ZGGNXa27gDhMRDF82OwsiwHRI4E9p0,4039
|
369
|
-
web3_wizzard_lib/resources/main/contracts.json,sha256=
|
370
|
-
web3_wizzard_lib/resources/main/networks.json,sha256=
|
370
|
+
web3_wizzard_lib/resources/main/contracts.json,sha256=VPKJLTFgZs_WgJIiKfJYOJVbUINNEbCPbUO1jaTSVQc,13410
|
371
|
+
web3_wizzard_lib/resources/main/networks.json,sha256=vtsHv3PmZVy9hct9xz0h3Uy3lxTkPgvDcvtUJNohE4M,6466
|
371
372
|
web3_wizzard_lib/resources/main/pairs.json,sha256=uvIFvY46Ctiw8hjGd9e-1WE0qLf_duo3MuZncRMLqGg,8262
|
372
373
|
web3_wizzard_lib/resources/main/tokens.json,sha256=AoZz_I6AVoZuecNdyX5L-SnGm6TREuPrsYd2i9PJr7U,5707
|
373
374
|
web3_wizzard_lib/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
374
375
|
web3_wizzard_lib/utils/debank_utils.py,sha256=y4eMvmxHcagqd-jtZFDfHw80bS6jbC0pC6znhDaz0pU,484
|
375
|
-
web3_wizzard_lib-1.
|
376
|
-
web3_wizzard_lib-1.
|
377
|
-
web3_wizzard_lib-1.
|
378
|
-
web3_wizzard_lib-1.
|
376
|
+
web3_wizzard_lib-1.13.1.dist-info/METADATA,sha256=yUP8wIpDrNZ9gUX-VN--UxpZ9C6GDTiQPjMTFpVd6ts,369
|
377
|
+
web3_wizzard_lib-1.13.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
378
|
+
web3_wizzard_lib-1.13.1.dist-info/top_level.txt,sha256=31sEPHxuJ1p5fpc75vHQJ8eJdSs80aCZeeT3L8YAHNg,17
|
379
|
+
web3_wizzard_lib-1.13.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|