web3-wizzard-lib 1.2.0__py3-none-any.whl → 1.2.2__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.
@@ -10,11 +10,11 @@ class GmxRewardRouter(Contract):
10
10
  super().__init__(contract_address, web3, abi)
11
11
 
12
12
  @evm_transaction
13
- def unstake_and_redeem(self, account, shares):
13
+ def unstake_and_redeem(self, account, glp_amount):
14
14
  txn_params = self.build_generic_data(account.address, False)
15
15
 
16
- contract_txn = self.contract.functions.redeem(
17
- shares,
16
+ contract_txn = self.contract.functions.unstakeAndRedeemGlpETH(
17
+ glp_amount,
18
18
  0,
19
19
  account.address,
20
20
  ).build_transaction(txn_params)
@@ -2,9 +2,10 @@ import requests
2
2
  from loguru import logger
3
3
  from sybil_engine.data.networks import get_chain_instance
4
4
  from sybil_engine.module.module import Module
5
- from sybil_engine.utils.statistic_utils import get_statistic_writer, statistic_date_string
6
5
  from web3 import Web3
7
6
 
7
+ from web3_wizzard_lib.core.utils.statistic_utils import get_statistic_writer, statistic_date_string
8
+
8
9
 
9
10
  class AirdropPrinter(Module):
10
11
  module_name = 'AIRDROP_PRINTER'
@@ -1,7 +1,8 @@
1
1
  import requests
2
2
  from sybil_engine.module.module import Module
3
3
  from sybil_engine.utils.accumulator import add_accumulator, get_value
4
- from sybil_engine.utils.statistic_utils import statistic_date_string, get_statistic_writer
4
+
5
+ from web3_wizzard_lib.core.utils.statistic_utils import statistic_date_string, get_statistic_writer
5
6
 
6
7
  TOTAL_USD = "TotalUSD"
7
8
  DEBANK_ACC_NUM = "DEBANK_ACC_NUM"
@@ -1,6 +1,7 @@
1
1
  from loguru import logger
2
2
  from sybil_engine.data.contracts import get_contracts_for_chain
3
3
  from sybil_engine.data.networks import get_chain_instance
4
+ from sybil_engine.domain.balance.tokens import Erc20Token
4
5
  from sybil_engine.module.module import Module
5
6
  from sybil_engine.utils.accumulator import add_accumulator
6
7
  from sybil_engine.utils.utils import ConfigurationException
@@ -21,7 +22,8 @@ class GMXRewardRouter(Module):
21
22
  contract_address = get_contracts_for_chain(chain_instance['chain'])['GMX_REWARD_ROUTER']
22
23
  gmx_reward_router = GmxRewardRouter(contract_address, web3)
23
24
 
24
- gmx_reward_router.unstake_and_redeem(account)
25
+ token = Erc20Token(chain, '0x1aDDD80E6039594eE970E5872D247bf0414C8903', web3)
26
+ gmx_reward_router.unstake_and_redeem(account, token.balance(account).wei)
25
27
 
26
28
  def log(self):
27
29
  return "GMX REWARD WITHDRAW"
@@ -4,11 +4,11 @@ import webbrowser
4
4
  from loguru import logger
5
5
  from sybil_engine.module.module import Module
6
6
  from sybil_engine.utils.accumulator import add_accumulator, get_value
7
- from sybil_engine.utils.statistic_utils import get_statistic_writer, statistic_date_string
8
7
 
9
8
  from web3_wizzard_lib.core.utils.ai_utils import get_ai_chat
10
9
 
11
10
  from web3_wizzard_lib.core.utils.module_memory import get_by_key, accumulate_by_key, remove_key, add_value
11
+ from web3_wizzard_lib.core.utils.statistic_utils import get_statistic_writer, statistic_date_string
12
12
 
13
13
  APPEAL_ACCOUNTS = "APPEAL_ACCOUNTS"
14
14
  APPEAL_ACCOUNTS_AMOUNT = "APPEAL_ACCOUNTS_AMOUNT"
@@ -5,9 +5,10 @@ from sybil_engine.domain.balance.balance import Erc20Balance
5
5
  from sybil_engine.domain.balance.tokens import Erc20Token
6
6
  from sybil_engine.module.module import Module
7
7
  from sybil_engine.utils.accumulator import add_accumulator_balance, add_accumulator, get_value
8
- from sybil_engine.utils.statistic_utils import statistic_date_string, get_statistic_writer
9
8
  from sybil_engine.utils.web3_utils import init_web3
10
9
 
10
+ from web3_wizzard_lib.core.utils.statistic_utils import statistic_date_string, get_statistic_writer
11
+
11
12
 
12
13
  class LineaPOHLXP(Module):
13
14
  module_name = 'LINEA_POH_LXP'
@@ -0,0 +1,142 @@
1
+ import csv
2
+ import datetime
3
+ import os
4
+ from google.oauth2.service_account import Credentials
5
+ from googleapiclient.discovery import build
6
+ from loguru import logger
7
+
8
+ from sybil_engine.utils.telegram import get_config
9
+
10
+ statistic_date_string = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
11
+
12
+
13
+ class StatisticsWriter:
14
+ def init_if_required(self, job_name, header):
15
+ pass
16
+
17
+ def write_row(self, job_name, row):
18
+ pass
19
+
20
+
21
+ class CsvStatisticsWriter(StatisticsWriter):
22
+ def init_if_required(self, job_name, header):
23
+ output_file = self._get_file_name(job_name)
24
+ file_exists = os.path.isfile(output_file)
25
+
26
+ rows_to_write = []
27
+
28
+ if not file_exists or os.path.getsize(output_file) == 0:
29
+ rows_to_write.append(header)
30
+
31
+ with open(output_file, mode='a', newline='') as file:
32
+ writer = csv.writer(file)
33
+ writer.writerows(rows_to_write)
34
+
35
+ def write_row(self, job_name, row):
36
+ rows_to_write = []
37
+ output_file = self._get_file_name(job_name)
38
+
39
+ rows_to_write.append(row)
40
+
41
+ with open(output_file, mode='a', newline='') as file:
42
+ writer = csv.writer(file)
43
+ writer.writerows(rows_to_write)
44
+
45
+ def _get_file_name(self, job_name):
46
+ return f'data/csv/{job_name}.csv'
47
+
48
+
49
+ class GoogleStatisticsWriter(StatisticsWriter):
50
+ def __init__(self, sheet):
51
+ self.SERVICE_ACCOUNT_FILE = 'data/service-accounts.json'
52
+ self.SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
53
+ self.credentials = Credentials.from_service_account_file(self.SERVICE_ACCOUNT_FILE, scopes=self.SCOPES)
54
+ self.service = build('sheets', 'v4', credentials=self.credentials)
55
+
56
+ self.sheet = sheet
57
+
58
+ def copy_sheet(self, source_sheet_name, destination_sheet_name):
59
+ # Get the source sheet ID
60
+ source_sheet = self.service.spreadsheets().get(spreadsheetId=self.sheet).execute()
61
+ source_sheet_id = next(
62
+ (sheet['properties']['sheetId'] for sheet in source_sheet['sheets'] if
63
+ sheet['properties']['title'] == source_sheet_name),
64
+ None
65
+ )
66
+
67
+ if source_sheet_id is None:
68
+ raise ValueError(f"Sheet '{source_sheet_name}' not found.")
69
+
70
+ # Create the request body for copying the sheet
71
+ request_body = {
72
+ 'destinationSpreadsheetId': self.sheet
73
+ }
74
+
75
+ # Copy the sheet to the same spreadsheet with the specified name
76
+ result = self.service.spreadsheets().sheets().copyTo(
77
+ spreadsheetId=self.sheet,
78
+ sheetId=source_sheet_id,
79
+ body=request_body
80
+ ).execute()
81
+
82
+ # Rename the copied sheet
83
+ body = {
84
+ 'requests': [
85
+ {
86
+ 'updateSheetProperties': {
87
+ 'properties': {
88
+ 'sheetId': result['sheetId'],
89
+ 'title': destination_sheet_name
90
+ },
91
+ 'fields': 'title'
92
+ }
93
+ }
94
+ ]
95
+ }
96
+ self.service.spreadsheets().batchUpdate(spreadsheetId=self.sheet, body=body).execute()
97
+
98
+ logger.info(f"Sheet copied. New sheet name: {destination_sheet_name}")
99
+
100
+ def init_if_required(self, sheet_name, header):
101
+ if not self._sheet_exists(sheet_name):
102
+ self._create_new_sheet(sheet_name)
103
+ self.write_row(sheet_name, header)
104
+
105
+ def _sheet_exists(self, sheet_name):
106
+ try:
107
+ self.service.spreadsheets().values().get(spreadsheetId=self.sheet, range=sheet_name).execute()
108
+ logger.info('Sheet exists.')
109
+ return True
110
+ except Exception:
111
+ return False
112
+
113
+ def _create_new_sheet(self, sheet_name):
114
+ body = {'requests': [{'addSheet': {'properties': {'title': sheet_name}}}]}
115
+ self.service.spreadsheets().batchUpdate(spreadsheetId=self.sheet, body=body).execute()
116
+ logger.info(f'Sheet "{sheet_name}" created.')
117
+
118
+ def write_cell(self, sheet_name, cell_reference, value):
119
+ range_ = f"{sheet_name}!{cell_reference}"
120
+ body = {'values': [[value]]}
121
+ self.service.spreadsheets().values().update(
122
+ spreadsheetId=self.sheet, range=range_, valueInputOption='USER_ENTERED', body=body
123
+ ).execute()
124
+ logger.info(f"Value written to cell {cell_reference} in sheet {sheet_name}: {value}")
125
+
126
+ def write_row(self, job_name, row):
127
+ range_ = f"{job_name}!A1"
128
+ rows_read = self.service.spreadsheets().values().get(spreadsheetId=self.sheet, range=range_).execute().get(
129
+ 'values', [])
130
+ body = {'values': [row]}
131
+ range_to_write = f"{job_name}!A{len(rows_read) + 1}"
132
+ self.service.spreadsheets().values().append(
133
+ spreadsheetId=self.sheet, range=range_to_write, valueInputOption='USER_ENTERED', body=body
134
+ ).execute()
135
+ logger.info(f'Row written: {row}')
136
+
137
+
138
+ def get_statistic_writer():
139
+ if get_config("STATISTICS_MODE") == "CSV":
140
+ return CsvStatisticsWriter()
141
+ else:
142
+ return GoogleStatisticsWriter(get_config("SPREADSHEET_ID"))
@@ -0,0 +1 @@
1
+ sybil-engine==10.0.10
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: web3_wizzard_lib
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: Engine for web3 smart contracts automatization.
5
5
  Home-page: https://github.com/Indeoo/web3-wizzard-lib/
6
6
  Author: Indeoo
7
7
  Author-email: indeooars@gmail.com
8
8
  Description-Content-Type: text/markdown
9
- Requires-Dist: sybil-engine==10.0.9
9
+ Requires-Dist: sybil-engine==10.0.10
10
10
  Dynamic: author
11
11
  Dynamic: author-email
12
12
  Dynamic: description-content-type
@@ -20,7 +20,7 @@ web3_wizzard_lib/core/contract/era_name.py,sha256=SyzGmm6HDlCHML3sLE1EouQn1gVfYH
20
20
  web3_wizzard_lib/core/contract/eralendcontract.py,sha256=agn2Z9dCHCgAeMzrzMkhO_x7KS2rtEfynIUWM64pPVk,1080
21
21
  web3_wizzard_lib/core/contract/eth_scroll_bridge_contract.py,sha256=zjiJN4uwaJTyAAPuugWQIisIdqfN0xh6prCGSeOWNvY,777
22
22
  web3_wizzard_lib/core/contract/frog_war_contract.py,sha256=AmpMHVfxubbbmPbMu_3ppSm-T5ZBvmSwaL6S0N548rw,1620
23
- web3_wizzard_lib/core/contract/gmx_reward_router.py,sha256=6zPu3ltPxu8K6jsKly3-cnhrtWAss81BbCgfIyRBOFw,699
23
+ web3_wizzard_lib/core/contract/gmx_reward_router.py,sha256=xDzmbaOnudjKmCpvnZ-ntxxlkbHZ3qMO7CzTbw83IEA,723
24
24
  web3_wizzard_lib/core/contract/horizondex_quoter.py,sha256=LLXBeAISVc87Ahx85_P-UZBcAGo3bXnh1phaJWbqVRI,548
25
25
  web3_wizzard_lib/core/contract/horizondex_router.py,sha256=qDNaJrjtguFG7fWhCUPQgcJYW9zTVOSHF8ae5tavnCY,3807
26
26
  web3_wizzard_lib/core/contract/imagine_contract.py,sha256=WdkqPhrEo86Ee7g3kRo-sq6c943R0-JGTXldF124FmY,672
@@ -91,7 +91,7 @@ web3_wizzard_lib/core/contract/zkdx_data.py,sha256=dtHkrSd_UurmX103mqxJQ1le7Mksw
91
91
  web3_wizzard_lib/core/contract/zks.py,sha256=QN9dKfWfA4cFKxzA8qcMnNBcdKmBmZMPeNqTlW92Ziw,823
92
92
  web3_wizzard_lib/core/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
93
  web3_wizzard_lib/core/modules/ads_import_proxy.py,sha256=6i_ZJ400Wg1_CLVqnhVHgRoJsjEYyOpMDUDNwtd2wIQ,1809
94
- web3_wizzard_lib/core/modules/airdrop_printer.py,sha256=_yY_pEm7XDVDIB0XgBNQkbhFCeDewoUHpxv3Hcmp-l0,2852
94
+ web3_wizzard_lib/core/modules/airdrop_printer.py,sha256=k1w1m8WAS9MnQ7LkKaYlx5xgi10pf12lcGJ0SrVA1OE,2862
95
95
  web3_wizzard_lib/core/modules/bridge_module.py,sha256=ZoO80ody9cP_ezhah680ezTAEdM2VyxRqmmUH7b2xHE,2011
96
96
  web3_wizzard_lib/core/modules/bungee.py,sha256=CVjZH5_nmBWO5Vg5Xx-_dDzfaJ7oCDgFp0gG8VHd76E,4881
97
97
  web3_wizzard_lib/core/modules/cex_sender.py,sha256=2akfVhaMvHnuKUBfiCTqnVuP3VWrJIStArBqQKpiU2I,2723
@@ -101,15 +101,15 @@ web3_wizzard_lib/core/modules/claimer.py,sha256=zjlbckMB6YWOZ3NFZrYWIhZ0wMqV4Rdb
101
101
  web3_wizzard_lib/core/modules/concrete_swap.py,sha256=nKhMX5Rlv4kqcNtfmEP8IFW9a4xnlAhjNkyTPrYby5s,3442
102
102
  web3_wizzard_lib/core/modules/coredao_bridge.py,sha256=WPC8wZlu25s7Hb-Uj34HyapbBu2kkT-hP8xAeEqv9bw,1023
103
103
  web3_wizzard_lib/core/modules/coredao_bridge_auto.py,sha256=lMKP07P5FuuSykN3eb3KN8R-MPBOdZHHN5IGkV8Zn8U,1447
104
- web3_wizzard_lib/core/modules/debank_checker.py,sha256=XCJk8VedNoHpdAQXk36dbdpZxJamcUuWDmud3i8ycPI,2792
104
+ web3_wizzard_lib/core/modules/debank_checker.py,sha256=AE7uCHAQY2VMxvY8QooDkH4O5GdmRAjJKG9uaIKCCYQ,2802
105
105
  web3_wizzard_lib/core/modules/dmail.py,sha256=ox5sMMQ7OqpSnLdt3VSvS0eFEhK5Qy8JZB5MsmNkp9k,1703
106
106
  web3_wizzard_lib/core/modules/erc20_balance.py,sha256=4mxd6QpOgnHHqUB0u6ya1Kh_xw3Mq7ObaILw8jgfVNk,1394
107
- web3_wizzard_lib/core/modules/gmx_reward.py,sha256=cdH3M-aCArtq56h9dDdYsvZFQrpog7_22nmDVITm4qU,1043
107
+ web3_wizzard_lib/core/modules/gmx_reward.py,sha256=tYKmDpSehpQLU7FFZALwXPnh_lY8pBDu1xq-uUjyNxA,1215
108
108
  web3_wizzard_lib/core/modules/intract_claim.py,sha256=jfXuLYCpgYsEZsf3FHxvDbfqcX1gI-ZC8QUiIIa71ZA,3753
109
109
  web3_wizzard_lib/core/modules/layer_2_20.py,sha256=1MvidKQBS5GhBzH6yAmjTf1VHnM96_Wb0sGF24TTXJo,2475
110
110
  web3_wizzard_lib/core/modules/lending_module.py,sha256=Sy0P-Ojt3e1JVMUCqpG06-DsiuTCvvHilgSj_QJPCwg,5517
111
- web3_wizzard_lib/core/modules/linea_appeal.py,sha256=ic178q1PoSN3ea6OoTrfyWLZvUAfTeNWuB5nMrIoiac,3600
112
- web3_wizzard_lib/core/modules/linea_poh_lxp.py,sha256=keipTIhT3SrOESNJdIJesHBOOM-NKVzMGqKEACEKIvQ,2320
111
+ web3_wizzard_lib/core/modules/linea_appeal.py,sha256=BUkhhNZGU1skrhB26IaQVA2aCKDICD-CieIxUmg71sU,3609
112
+ web3_wizzard_lib/core/modules/linea_poh_lxp.py,sha256=kVVtd5gkcEdyYc3YSRlECgPmDskLbx0W_4C7ErzM5Hg,2330
113
113
  web3_wizzard_lib/core/modules/liquidity_pool.py,sha256=vu0vBoXomvAJFa10n9woo66v62hQbEO726M4lkiLWNE,2181
114
114
  web3_wizzard_lib/core/modules/merkly_refuel.py,sha256=whQD6CplGt-hQxFN7lg40F6SmFU5niOO529lKMj0dyA,3488
115
115
  web3_wizzard_lib/core/modules/new_rage_withdraw.py,sha256=OosuYItBZavXeqcQQDHL6FqLZv7tD-J8UZZx_0VYzG8,1534
@@ -259,6 +259,7 @@ web3_wizzard_lib/core/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
259
259
  web3_wizzard_lib/core/utils/ai_utils.py,sha256=hNRgDbD363RNS35bOgYFlSo6P6yqU6ptZ6fIkoMkL44,1025
260
260
  web3_wizzard_lib/core/utils/benchmark_utils.py,sha256=3YBPXseWJb_BpBJtWWU6Dc5kydyhX4YWSvEWj4v6ekk,286
261
261
  web3_wizzard_lib/core/utils/module_memory.py,sha256=Ot-C3g9ax9frTTpWSLQqsbGcp7WMmmHKM9R7qI920xk,436
262
+ web3_wizzard_lib/core/utils/statistic_utils.py,sha256=qZjLAnnyFuXV5xmfHaIdtWHzZJbNHmNx551k7-ziddw,5136
262
263
  web3_wizzard_lib/core/utils/sub_module.py,sha256=r7C89nhlOUAYtCI92JINapS_-5hUUYX7YnY9hQLgHKg,117
263
264
  web3_wizzard_lib/resources/banner.txt,sha256=SU35B1n9GopZLhMIwWFF6L2z4_kxz1N1ZhN8LZx49SA,666
264
265
  web3_wizzard_lib/resources/linea_appeal.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -360,8 +361,8 @@ web3_wizzard_lib/resources/main/contracts.json,sha256=jGeEoEiys1Itg7s5WFIeVFKis9
360
361
  web3_wizzard_lib/resources/main/networks.json,sha256=dmZLOsSaj2_CJwLqS4Deb4FgQrxPWpIQKGml6cXfKzI,6465
361
362
  web3_wizzard_lib/resources/main/pairs.json,sha256=uvIFvY46Ctiw8hjGd9e-1WE0qLf_duo3MuZncRMLqGg,8262
362
363
  web3_wizzard_lib/resources/main/tokens.json,sha256=AoZz_I6AVoZuecNdyX5L-SnGm6TREuPrsYd2i9PJr7U,5707
363
- web3_wizzard_lib-1.2.0.data/data/requirements.txt,sha256=5oZVZuID8L00sR9kJZYJg-TYMRN1WY93ktdNIhPIzX8,20
364
- web3_wizzard_lib-1.2.0.dist-info/METADATA,sha256=DPd1Lxlmfy2ZAaF4GKEfd-NeZddDzsE6nCQQFpXBASA,428
365
- web3_wizzard_lib-1.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
366
- web3_wizzard_lib-1.2.0.dist-info/top_level.txt,sha256=8dD8S5HQo4dKtxogttWY_sh4n3yCVy0MwiTelYp6kug,28
367
- web3_wizzard_lib-1.2.0.dist-info/RECORD,,
364
+ web3_wizzard_lib-1.2.2.data/data/requirements.txt,sha256=t9n8T01EJ51Xg35D4jrLSpIA5fpMukAvtyZkT_5xV8U,21
365
+ web3_wizzard_lib-1.2.2.dist-info/METADATA,sha256=VpkePo8gwKHHTTYbmnMsHZ7oXW1E3-5nmNW27O09ccw,429
366
+ web3_wizzard_lib-1.2.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
367
+ web3_wizzard_lib-1.2.2.dist-info/top_level.txt,sha256=8dD8S5HQo4dKtxogttWY_sh4n3yCVy0MwiTelYp6kug,28
368
+ web3_wizzard_lib-1.2.2.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- sybil-engine==10.0.9