web3-wizzard-lib 0.0.2__py3-none-any.whl → 0.1.0__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.
Files changed (298) hide show
  1. web3_wizzard_lib/core/modules/linea_appeal.py +69 -52
  2. web3_wizzard_lib/core/modules/stargate/farming.py +1 -1
  3. web3_wizzard_lib/core/utils/ai_utils.py +45 -0
  4. web3_wizzard_lib/core/utils/benchmark_utils.py +12 -0
  5. web3_wizzard_lib/core/utils/module_memory.py +26 -0
  6. web3_wizzard_lib-0.1.0.data/data/requirements.txt +1 -0
  7. {web3_wizzard_lib-0.0.2.dist-info → web3_wizzard_lib-0.1.0.dist-info}/METADATA +9 -4
  8. {web3_wizzard_lib-0.0.2.dist-info → web3_wizzard_lib-0.1.0.dist-info}/RECORD +10 -294
  9. {web3_wizzard_lib-0.0.2.dist-info → web3_wizzard_lib-0.1.0.dist-info}/WHEEL +1 -1
  10. core/__init__.py +0 -1
  11. core/contract/__init__.py +0 -0
  12. core/contract/aavecontract.py +0 -36
  13. core/contract/alienswap_contract.py +0 -21
  14. core/contract/arena_games_contract.py +0 -16
  15. core/contract/basiliskcontract.py +0 -58
  16. core/contract/bilinear_contract.py +0 -22
  17. core/contract/bungee.py +0 -33
  18. core/contract/coredao_contract.py +0 -35
  19. core/contract/coredao_from_contract.py +0 -40
  20. core/contract/dmail_send_mail.py +0 -18
  21. core/contract/empty_nft.py +0 -18
  22. core/contract/era_name.py +0 -23
  23. core/contract/eralendcontract.py +0 -34
  24. core/contract/eth_scroll_bridge_contract.py +0 -25
  25. core/contract/frog_war_contract.py +0 -48
  26. core/contract/horizondex_quoter.py +0 -14
  27. core/contract/horizondex_router.py +0 -91
  28. core/contract/imagine_contract.py +0 -18
  29. core/contract/izumi.py +0 -63
  30. core/contract/kreatorland_contract.py +0 -21
  31. core/contract/l0_claim.py +0 -254
  32. core/contract/l2_telegraph.py +0 -21
  33. core/contract/layerbank_price.py +0 -18
  34. core/contract/layerbank_token.py +0 -29
  35. core/contract/layerbankcontract.py +0 -59
  36. core/contract/linea_day_2_contract.py +0 -19
  37. core/contract/linea_day_3_contract.py +0 -55
  38. core/contract/linea_ens_names_contract.py +0 -55
  39. core/contract/lineaswaprouter.py +0 -52
  40. core/contract/maverick_multicall.py +0 -52
  41. core/contract/mendi_finance_contract.py +0 -11
  42. core/contract/mendi_token.py +0 -25
  43. core/contract/merkly_minter.py +0 -47
  44. core/contract/micro3_contract.py +0 -18
  45. core/contract/mute_router.py +0 -93
  46. core/contract/nidum_contract.py +0 -44
  47. core/contract/nile_contract.py +0 -60
  48. core/contract/nomis_attest_contract.py +0 -40
  49. core/contract/nomis_contract.py +0 -40
  50. core/contract/octomos.py +0 -31
  51. core/contract/odos.py +0 -104
  52. core/contract/omnisea.py +0 -29
  53. core/contract/orbiter_starknet.py +0 -30
  54. core/contract/pancake_pool.py +0 -19
  55. core/contract/pancake_quoter.py +0 -20
  56. core/contract/pancake_router.py +0 -72
  57. core/contract/rage_claim.py +0 -24
  58. core/contract/reactor_fusion_contract.py +0 -78
  59. core/contract/readon_contract.py +0 -19
  60. core/contract/rubyscore_contract.py +0 -31
  61. core/contract/satoshi_universe_contract.py +0 -29
  62. core/contract/scroll_bridge_contract.py +0 -24
  63. core/contract/scroll_canvas_mint_contract.py +0 -26
  64. core/contract/scroll_oracle.py +0 -11
  65. core/contract/snap_contract.py +0 -16
  66. core/contract/social_scan_contract.py +0 -20
  67. core/contract/stargate_farming.py +0 -37
  68. core/contract/stargate_router.py +0 -84
  69. core/contract/stargate_router_eth.py +0 -41
  70. core/contract/stargate_token_pool.py +0 -46
  71. core/contract/stargate_v2_contract.py +0 -36
  72. core/contract/syncswap_classic_pool.py +0 -15
  73. core/contract/syncswap_classic_pool_factory.py +0 -15
  74. core/contract/syncswap_pool.py +0 -25
  75. core/contract/syncswap_router.py +0 -123
  76. core/contract/tavaera_id.py +0 -18
  77. core/contract/tavaera_mint.py +0 -17
  78. core/contract/townstory_bonus_contract.py +0 -19
  79. core/contract/townstory_contract.py +0 -21
  80. core/contract/velocore_lens.py +0 -44
  81. core/contract/velocore_pool.py +0 -198
  82. core/contract/velocore_router.py +0 -80
  83. core/contract/woofi_swap.py +0 -29
  84. core/contract/xy_finance_contract.py +0 -87
  85. core/contract/yoddlo_contract.py +0 -19
  86. core/contract/yuliverse_contract.py +0 -36
  87. core/contract/zebra_contract.py +0 -68
  88. core/contract/zerolend_contract.py +0 -34
  89. core/contract/zerolend_liq_contract.py +0 -20
  90. core/contract/zkdx_contract.py +0 -40
  91. core/contract/zkdx_data.py +0 -14
  92. core/contract/zks.py +0 -24
  93. core/modules/__init__.py +0 -0
  94. core/modules/ads_import_proxy.py +0 -52
  95. core/modules/airdrop_printer.py +0 -80
  96. core/modules/bank/__init__.py +0 -0
  97. core/modules/bank/aave.py +0 -25
  98. core/modules/bank/bank.py +0 -15
  99. core/modules/bank/bank_module.py +0 -99
  100. core/modules/bank/basilisk.py +0 -25
  101. core/modules/bank/eralend.py +0 -25
  102. core/modules/bank/layerbank.py +0 -116
  103. core/modules/bank/mendi_finance.py +0 -57
  104. core/modules/bank/reactorfusion.py +0 -25
  105. core/modules/bank/zerolend.py +0 -36
  106. core/modules/bridge/__init__.py +0 -0
  107. core/modules/bridge/bridge.py +0 -8
  108. core/modules/bridge/coredao_bridge_sub.py +0 -47
  109. core/modules/bridge/orbiter_sub.py +0 -112
  110. core/modules/bridge/scroll_bridge_sub.py +0 -42
  111. core/modules/bridge/stargate_v2_sub.py +0 -74
  112. core/modules/bridge_module.py +0 -47
  113. core/modules/bungee.py +0 -109
  114. core/modules/cex_sender.py +0 -60
  115. core/modules/cex_subaccount_transfer.py +0 -34
  116. core/modules/cex_withdraw.py +0 -91
  117. core/modules/claimer.py +0 -45
  118. core/modules/claims/__init__.py +0 -0
  119. core/modules/claims/layerzero_claimer.py +0 -64
  120. core/modules/claims/rabby_claimer.py +0 -81
  121. core/modules/concrete_swap.py +0 -97
  122. core/modules/coredao_bridge.py +0 -32
  123. core/modules/coredao_bridge_auto.py +0 -39
  124. core/modules/debank_checker.py +0 -90
  125. core/modules/dmail.py +0 -54
  126. core/modules/erc20_balance.py +0 -42
  127. core/modules/intract/__init__.py +0 -0
  128. core/modules/intract/intract_api.py +0 -212
  129. core/modules/intract/utils.py +0 -81
  130. core/modules/intract_claim.py +0 -104
  131. core/modules/layer_2_20.py +0 -65
  132. core/modules/lending_module.py +0 -134
  133. core/modules/linea_appeal.py +0 -70
  134. core/modules/linea_poh_lxp.py +0 -64
  135. core/modules/liquidity/__init__.py +0 -0
  136. core/modules/liquidity/nile_pool.py +0 -64
  137. core/modules/liquidity/pool.py +0 -16
  138. core/modules/liquidity/syncswap_pool.py +0 -61
  139. core/modules/liquidity/velocore_pool.py +0 -55
  140. core/modules/liquidity/zerolend_liquidity.py +0 -26
  141. core/modules/liquidity_pool.py +0 -60
  142. core/modules/merkly_refuel.py +0 -87
  143. core/modules/modules.py +0 -4
  144. core/modules/nft/__init__.py +0 -0
  145. core/modules/nft/abbys_world.py +0 -22
  146. core/modules/nft/acg_worlds.py +0 -25
  147. core/modules/nft/alienswap_linea.py +0 -22
  148. core/modules/nft/arena_games.py +0 -22
  149. core/modules/nft/asmatch.py +0 -22
  150. core/modules/nft/battlemon.py +0 -25
  151. core/modules/nft/bilinear.py +0 -22
  152. core/modules/nft/bitavatar.py +0 -25
  153. core/modules/nft/culture_satoshi_universe.py +0 -24
  154. core/modules/nft/efrogs.py +0 -26
  155. core/modules/nft/empty_nft.py +0 -22
  156. core/modules/nft/era_domain.py +0 -42
  157. core/modules/nft/frog_war.py +0 -22
  158. core/modules/nft/frog_war_bonus.py +0 -22
  159. core/modules/nft/gamerboom.py +0 -25
  160. core/modules/nft/gamerboom_bonus.py +0 -26
  161. core/modules/nft/imagine.py +0 -32
  162. core/modules/nft/kreatorland_module.py +0 -35
  163. core/modules/nft/l2_telegraph_module.py +0 -22
  164. core/modules/nft/layer3_meta.py +0 -25
  165. core/modules/nft/linea_culture_2_2_linus.py +0 -24
  166. core/modules/nft/linea_culture_2_3_yooldo.py +0 -24
  167. core/modules/nft/linea_culture_2_4_frogwar.py +0 -24
  168. core/modules/nft/linea_culture_2_5_acg.py +0 -25
  169. core/modules/nft/linea_culture_2_6_ascend_the_end.py +0 -25
  170. core/modules/nft/linea_culture_3_1_ascend_the_end.py +0 -25
  171. core/modules/nft/linea_culture_3_2_sending_me.py +0 -25
  172. core/modules/nft/linea_culture_3_3_townstory.py +0 -25
  173. core/modules/nft/linea_culture_3_4_daniele.py +0 -25
  174. core/modules/nft/linea_culture_3_5_demmortal.py +0 -25
  175. core/modules/nft/linea_culture_3_6_foxy.py +0 -25
  176. core/modules/nft/linea_culture_4_1_coop_records.py +0 -60
  177. core/modules/nft/linea_culture_4_2_borja_moskv.py +0 -65
  178. core/modules/nft/linea_culture_4_2_borja_moskv_approve.py +0 -27
  179. core/modules/nft/linea_culture_4_3_fruit.py +0 -66
  180. core/modules/nft/linea_culture_4_4_fruit_crux.py +0 -67
  181. core/modules/nft/linea_culture_4_5_forbidden_fruit.py +0 -67
  182. core/modules/nft/linea_culture_4_6_laurent.py +0 -67
  183. core/modules/nft/linea_culture_day2.py +0 -20
  184. core/modules/nft/linea_culture_day3.py +0 -20
  185. core/modules/nft/linea_ens_names.py +0 -107
  186. core/modules/nft/lucky_cat.py +0 -25
  187. core/modules/nft/merkly_minter_module.py +0 -22
  188. core/modules/nft/micro3.py +0 -23
  189. core/modules/nft/mint_2048.py +0 -28
  190. core/modules/nft/nft_submodule.py +0 -16
  191. core/modules/nft/nidum.py +0 -87
  192. core/modules/nft/nidum_bonus.py +0 -23
  193. core/modules/nft/nomis.py +0 -64
  194. core/modules/nft/nomis_attest.py +0 -66
  195. core/modules/nft/nouns.py +0 -27
  196. core/modules/nft/octomos.py +0 -32
  197. core/modules/nft/omnisea.py +0 -33
  198. core/modules/nft/omnizone.py +0 -25
  199. core/modules/nft/orbiter_claim.py +0 -87
  200. core/modules/nft/readon.py +0 -30
  201. core/modules/nft/rubyscore.py +0 -45
  202. core/modules/nft/sarubol.py +0 -22
  203. core/modules/nft/satoshi_universe.py +0 -22
  204. core/modules/nft/scroll_canvas_attest_year_badge.py +0 -35
  205. core/modules/nft/scroll_canvas_mint.py +0 -51
  206. core/modules/nft/sign.py +0 -32
  207. core/modules/nft/snap.py +0 -25
  208. core/modules/nft/snap_bonus.py +0 -31
  209. core/modules/nft/social_scan.py +0 -22
  210. core/modules/nft/sub_module.py +0 -8
  211. core/modules/nft/tavaera.py +0 -30
  212. core/modules/nft/townstory.py +0 -75
  213. core/modules/nft/townstory_bonus.py +0 -45
  214. core/modules/nft/trusta_reputation.py +0 -48
  215. core/modules/nft/trustaa_poh.py +0 -49
  216. core/modules/nft/uber_poh.py +0 -24
  217. core/modules/nft/wizards_of_linea.py +0 -26
  218. core/modules/nft/yoddlo.py +0 -22
  219. core/modules/nft/yuliverse.py +0 -22
  220. core/modules/nft/zace.py +0 -25
  221. core/modules/nft/zks_domain.py +0 -41
  222. core/modules/nft_minter.py +0 -107
  223. core/modules/orbiter.py +0 -39
  224. core/modules/orbiter_checker.py +0 -26
  225. core/modules/rage.py +0 -54
  226. core/modules/scroll_bridge.py +0 -45
  227. core/modules/sell_all.py +0 -51
  228. core/modules/sleep_module.py +0 -25
  229. core/modules/smart_contract_deployment.py +0 -37
  230. core/modules/stargate/__init__.py +0 -0
  231. core/modules/stargate/auto_bridge.py +0 -91
  232. core/modules/stargate/bridge.py +0 -38
  233. core/modules/stargate/bridge_eth.py +0 -59
  234. core/modules/stargate/bridge_tokens.py +0 -48
  235. core/modules/stargate/classic_bridge.py +0 -34
  236. core/modules/stargate/farming.py +0 -163
  237. core/modules/stargate/l0_data.py +0 -10
  238. core/modules/stargate/pool.py +0 -74
  239. core/modules/stargate/stargate_balance_utils.py +0 -25
  240. core/modules/stargate/stargate_gas_checker.py +0 -68
  241. core/modules/swap/__init__.py +0 -1
  242. core/modules/swap/horizondex.py +0 -38
  243. core/modules/swap/izumi.py +0 -41
  244. core/modules/swap/lineaswap.py +0 -34
  245. core/modules/swap/maverick.py +0 -66
  246. core/modules/swap/mute.py +0 -39
  247. core/modules/swap/odos.py +0 -58
  248. core/modules/swap/one_inch.py +0 -58
  249. core/modules/swap/pancake.py +0 -41
  250. core/modules/swap/swap_facade.py +0 -10
  251. core/modules/swap/syncswap.py +0 -62
  252. core/modules/swap/velocore.py +0 -40
  253. core/modules/swap/woofi.py +0 -38
  254. core/modules/swap/xy_finance.py +0 -43
  255. core/modules/swap/zebra.py +0 -32
  256. core/modules/warm_up.py +0 -98
  257. core/modules/wrapping.py +0 -74
  258. core/modules/zkdx.py +0 -63
  259. tests/core/__init__.py +0 -0
  260. tests/core/contracts/__init__.py +0 -0
  261. tests/core/contracts/test_horizondex_quoter.py +0 -37
  262. tests/core/contracts/test_uniswap_quoter.py +0 -35
  263. tests/core/contracts/test_velocore_lens.py +0 -67
  264. tests/core/contracts/test_velocore_pool.py +0 -57
  265. tests/core/modules/__init__.py +0 -67
  266. tests/core/modules/swap/__init__.py +0 -0
  267. tests/core/modules/swap/test_horizondex.py +0 -37
  268. tests/core/modules/swap/test_lineaswap.py +0 -28
  269. tests/core/modules/swap/test_maverick.py +0 -31
  270. tests/core/modules/swap/test_mute.py +0 -29
  271. tests/core/modules/swap/test_odos.py +0 -36
  272. tests/core/modules/swap/test_pancake.py +0 -54
  273. tests/core/modules/swap/test_syncswap.py +0 -59
  274. tests/core/modules/swap/test_velocore.py +0 -33
  275. tests/core/modules/swap/test_woofi.py +0 -22
  276. tests/core/modules/test_bungee.py +0 -27
  277. tests/core/modules/test_concrete_swap.py +0 -62
  278. tests/core/modules/test_dmail.py +0 -41
  279. tests/core/modules/test_lending.py +0 -122
  280. tests/core/modules/test_nft.py +0 -32
  281. tests/core/modules/test_nft_minter.py +0 -30
  282. tests/core/modules/test_orbiter.py +0 -28
  283. tests/core/modules/test_sellall.py +0 -27
  284. tests/core/modules/test_send_to_cex.py +0 -27
  285. tests/core/modules/test_stargate_auto_bridge.py +0 -32
  286. tests/core/modules/test_stargate_bridge.py +0 -25
  287. tests/core/modules/test_stargate_farming.py +0 -108
  288. tests/core/modules/test_warmup.py +0 -78
  289. tests/core/modules/test_wrapping.py +0 -68
  290. tests/core/scenario/__init__.py +0 -0
  291. tests/core/scenario/module_0_test_config.py +0 -91
  292. tests/core/test_app.py +0 -19
  293. tests/core/test_config.py +0 -34
  294. web3_wizzard_lib/core/modules/modules.py +0 -27
  295. web3_wizzard_lib/core/modules/nft/sub_module.py +0 -8
  296. web3_wizzard_lib/core/modules/swap/swap_facade.py +0 -10
  297. web3_wizzard_lib-0.0.2.data/data/requirements.txt +0 -1
  298. {web3_wizzard_lib-0.0.2.dist-info → web3_wizzard_lib-0.1.0.dist-info}/top_level.txt +0 -0
@@ -1,59 +0,0 @@
1
- from loguru import logger
2
- from sybil_engine.data.contracts import get_contracts_for_chain
3
- from sybil_engine.domain.balance.balance import NotEnoughNativeBalance
4
- from sybil_engine.domain.balance.balance_utils import from_wei_to_eth, from_eth_to_wei
5
- from sybil_engine.utils.utils import interval_to_round
6
-
7
- from web3_wizzard_lib.core.contract.stargate_router_eth import StargateRouterEth
8
- from web3_wizzard_lib.core.modules.stargate.stargate_gas_checker import get_native_fee_balance
9
-
10
-
11
- def bridge_eth(native_without_min, account, bridge_amount_interval, from_chain_instance, to_chain_instance, web3):
12
- contracts = get_contracts_for_chain(from_chain_instance['chain'])
13
-
14
- native_fee = get_native_fee_balance(
15
- 'ETH',
16
- native_without_min,
17
- from_chain_instance,
18
- to_chain_instance,
19
- account,
20
- web3
21
- )
22
-
23
- if native_fee.wei > native_without_min.wei:
24
- raise NotEnoughNativeBalance(
25
- f"Native balance ({native_without_min}) "
26
- f"in {native_without_min.chain} is lower than required fee ({native_fee}",
27
- from_chain_instance['chain']
28
- )
29
-
30
- if bridge_amount_interval == 'all_balance':
31
- value_wei = native_without_min.wei
32
-
33
- if value_wei < 0:
34
- raise Exception('Not enough balance')
35
-
36
- amount_to_bridge_wei = value_wei - native_fee.wei
37
- amount_to_bridge_eth = from_wei_to_eth(amount_to_bridge_wei)
38
- else:
39
- amount_to_bridge_eth = interval_to_round(bridge_amount_interval)
40
- amount_to_bridge_wei = from_eth_to_wei(amount_to_bridge_eth)
41
-
42
- value_wei = amount_to_bridge_wei + native_fee.wei
43
-
44
- value_wei = value_wei
45
- value_eth = from_wei_to_eth(value_wei)
46
-
47
- if value_wei > native_without_min.wei:
48
- raise NotEnoughNativeBalance(
49
- f"The account balance ({native_without_min}) < bridging amount ({value_eth}{native_without_min.token}).")
50
-
51
- logger.info(f"Bridging: {amount_to_bridge_eth} {native_without_min.token}")
52
- logger.info(f"Trying to bridge with value: {value_eth}{native_without_min.token}")
53
-
54
- stargate_router_eth_address = contracts["STARGATE_ROUTER_ETH"]
55
- stargate_router = StargateRouterEth(stargate_router_eth_address, web3)
56
-
57
- args = [account, value_wei, amount_to_bridge_wei, to_chain_instance]
58
-
59
- stargate_router.swap_eth(*args)
@@ -1,48 +0,0 @@
1
- from loguru import logger
2
- from sybil_engine.data.contracts import get_contracts_for_chain
3
- from sybil_engine.domain.balance.balance import Erc20Balance, NotEnoughNativeBalance
4
- from sybil_engine.domain.balance.tokens import Erc20Token
5
- from sybil_engine.utils.web3_utils import get_amount_to_bridge_usdc
6
-
7
- from web3_wizzard_lib.core.contract.stargate_router import StargateRouter
8
-
9
-
10
- def bridge_usdc(native_balance, account, bridge_amount_interval, from_chain_config, to_chain_config, web3):
11
- if (from_chain_config['chain'] == 'FANTOM' and to_chain_config['chain'] == 'BASE') or (
12
- to_chain_config['chain'] == 'FANTOM' and from_chain_config['chain'] == 'BASE'):
13
- raise Exception('Stargate does not allow FANTOM<>BASE USDC transfer ')
14
- erc20_token = Erc20Token(from_chain_config['chain'], 'USDC', web3)
15
-
16
- token_balance = erc20_token.balance(account)
17
-
18
- logger.info(f"Token balance: {token_balance}")
19
-
20
- if token_balance.wei == 0:
21
- raise Exception(f"USDC balance is 0")
22
-
23
- amount_to_bridge = token_balance if bridge_amount_interval == 'all_balance' else Erc20Balance(
24
- get_amount_to_bridge_usdc(bridge_amount_interval),
25
- native_balance.chain,
26
- 'USDC'
27
- )
28
-
29
- if amount_to_bridge.wei > token_balance.wei:
30
- raise NotEnoughNativeBalance(f"Account balance ({amount_to_bridge}) < {amount_to_bridge} amount to bridge.")
31
-
32
- logger.info(f"Bridging: {amount_to_bridge}")
33
-
34
- erc20_token = Erc20Token(from_chain_config['chain'], "USDC", web3)
35
-
36
- chain_contracts = get_contracts_for_chain(from_chain_config['chain'])
37
-
38
- stargate_router_address = chain_contracts["STARGATE_ROUTER"]
39
-
40
- if erc20_token.allowance(account, stargate_router_address) < amount_to_bridge.wei:
41
- erc20_token.allowance(account, stargate_router_address)
42
-
43
- stargate_router = StargateRouter(chain_contracts["STARGATE_ROUTER"], web3)
44
- native_fee_wei = stargate_router.count_native_fee_stargate(to_chain_config['stargate_chain_id'], account.address)
45
-
46
- args = [account, native_fee_wei, amount_to_bridge, to_chain_config]
47
-
48
- stargate_router.swap(*args)
@@ -1,34 +0,0 @@
1
- from sybil_engine.module.module import Module, Order
2
-
3
- from web3_wizzard_lib.core.modules.stargate.bridge import StargateBridge
4
-
5
-
6
- class StargateBridgeModule(Module):
7
- module_name = 'STARGATE_CLASSIC_BRIDGE'
8
- module_config = 'stargate_classic_config'
9
- random_order = Order.STRICT
10
-
11
- def execute(self, bridge_amount_interval, bridge_token, retry_interval, from_chain, to_chain, account):
12
- StargateBridge(retry_interval).bridge(
13
- self.min_native_balance,
14
- account,
15
- bridge_amount_interval,
16
- bridge_token,
17
- from_chain,
18
- to_chain
19
- )
20
-
21
- def log(self):
22
- return "STARGATE CLASSIC"
23
-
24
- def parse_params(self, module_params):
25
- if 'retry_interval' not in module_params:
26
- module_params['retry_interval'] = {'from': 60 * 5, 'to': 60 * 10}
27
-
28
- return (
29
- module_params['bridge_amount_interval'],
30
- module_params['bridge_token'],
31
- module_params['retry_interval'],
32
- module_params['from_chain'],
33
- module_params['to_chain']
34
- )
@@ -1,163 +0,0 @@
1
- from loguru import logger
2
- from sybil_engine.config.app_config import get_network
3
- from sybil_engine.data.contracts import get_contracts_for_chain
4
- from sybil_engine.data.networks import get_chain_instance
5
- from sybil_engine.domain.balance.balance import Erc20Balance, NativeBalance
6
- from sybil_engine.domain.balance.balance_utils import get_native_balance, interval_to_eth_balance
7
- from sybil_engine.domain.balance.tokens import Erc20Token
8
- from sybil_engine.module.module import Module
9
- from sybil_engine.utils.utils import randomized_sleeping
10
- from sybil_engine.utils.web3_utils import init_web3, get_amount_to_bridge_usdc, get_max_balance_data
11
-
12
- from web3_wizzard_lib.core.contract.stargate_farming import StargateFarming
13
- from web3_wizzard_lib.core.contract.stargate_router import StargateRouter
14
- from web3_wizzard_lib.core.modules.stargate.pool import add_to_pool, find_max_pool_chain, get_pool_token_name, get_pool_balances
15
- from web3_wizzard_lib.core.modules import StargatePoolToken
16
-
17
- all_chains = {
18
- 'MAIN': {
19
- 'USDC': ['ARBITRUM', 'BASE', 'BSC', 'POLYGON', 'AVALANCHE', 'OPTIMISM', 'FANTOM'],
20
- 'ETH': ['ARBITRUM', 'BASE', 'LINEA', 'OPTIMISM']
21
- },
22
- 'LOCAL': {
23
- 'USDC': ['BASE'],
24
- 'ETH': ['BASE']
25
- },
26
- 'GOERLI': {
27
- 'USDC': ['LINEA', 'BASE'],
28
- 'ETH': ['LINEA', 'BASE']
29
- }
30
- }
31
-
32
-
33
- class StargateFarmingModule(Module):
34
- module_name = 'STARGATE_FARMING'
35
- module_config = 'stargate_farming_config'
36
-
37
- def execute(self, bridge_amount_interval, chain, operation, all_balance_mode, token, operation_sleep_interval,
38
- account):
39
- try:
40
- logger.info(f"=============== Stargate staking: {account.address} ===============")
41
-
42
- chains = all_chains[get_network()][token]
43
-
44
- if 'ADD_TO_POOL' in operation:
45
- self.add_to_pool_logic(account, all_balance_mode, bridge_amount_interval, chain, chains, token)
46
- randomized_sleeping(operation_sleep_interval)
47
-
48
- if 'DEPOSIT' in operation:
49
- self.deposit_logic(account, chains, token)
50
- randomized_sleeping(operation_sleep_interval)
51
-
52
- if 'WITHDRAW' in operation:
53
- self.withdraw_logic(account, chains, token)
54
- randomized_sleeping(operation_sleep_interval)
55
-
56
- if 'REDEEM_FROM_POOL' in operation:
57
- self.redeem_from_pool_logic(account, chains, token)
58
- randomized_sleeping(operation_sleep_interval)
59
- except Exception as e:
60
- logger.info(f"Error during farming: {e}")
61
-
62
- def redeem_from_pool_logic(self, account, chains, token):
63
- pool_balances = get_pool_balances(token, account, chains)
64
- chain, pool_balance, web3 = find_max_pool_chain(pool_balances)
65
- chain_instance = get_chain_instance(chain)
66
- stargate_router = StargateRouter(get_contracts_for_chain(chain)["STARGATE_ROUTER"], web3)
67
- logger.info(f"Redeem from {chain} pool {pool_balance}")
68
- if token == 'USDC':
69
- stargate_pool_id = chain_instance['stargate_usdc_pool']
70
- else:
71
- stargate_pool_id = chain_instance['stargate_eth_pool']
72
- if pool_balance.wei > 0:
73
- stargate_router.instant_redeem(account, pool_balance.wei, stargate_pool_id)
74
- else:
75
- logger.info(f"Pool is empty, ignoring")
76
-
77
- def withdraw_logic(self, account, chains, token):
78
- logger.info("Withdraw from farming")
79
- farm_balances = self.get_farm_balances(account, token, chains)
80
- chain, farm_balance, web3 = find_max_pool_chain(farm_balances)
81
- farming_address = get_contracts_for_chain(chain)['STARGATE_FARMING']
82
- stargate_farming = StargateFarming(farming_address, web3)
83
- logger.info(f"Balance in farming {farm_balance}, withdrawing all")
84
- if farm_balance.wei > 0:
85
- stargate_farming.withdraw(account, farm_balance.wei)
86
- else:
87
- logger.info(f"Farming balance is empty, ignoring")
88
-
89
- def deposit_logic(self, account, chains, token):
90
- logger.info("Deposit to farm")
91
-
92
- pool_balances = get_pool_balances(token, account, chains)
93
- chain, pool_balance, web3 = find_max_pool_chain(pool_balances)
94
-
95
- chain_instance = get_chain_instance(chain)
96
- farming_address = get_contracts_for_chain(chain)['STARGATE_FARMING']
97
-
98
- stargate_farming = StargateFarming(farming_address, web3)
99
- logger.info(f"Amount in {chain} pool {pool_balance}")
100
-
101
- pool_token_name = get_pool_token_name(token)
102
- stargate_pool_token = StargatePoolToken(chain, pool_token_name, web3)
103
-
104
- if stargate_pool_token.allowance(account, farming_address) < pool_balance.wei:
105
- stargate_pool_token.approve(account, farming_address)
106
-
107
- stargate_farming.deposit(account, pool_balance)
108
-
109
- def add_to_pool_logic(self, account, all_balance_mode, bridge_amount_interval, chain, chains, token):
110
-
111
- def get_balance_to_pool(token_type, chain_instance, web3):
112
- if token_type == 'USDC':
113
- stargate_token = Erc20Token(chain, 'USDC', web3)
114
- return stargate_token.balance(account)
115
- else:
116
- return get_native_balance(account, web3, chain_instance)
117
-
118
- if bridge_amount_interval == 'all_balance':
119
- if all_balance_mode == 0:
120
- max_balance_chain, amount_to_pool, native_balance, web3 = get_max_balance_data(token, chains, account)
121
- chain_instance = get_chain_instance(max_balance_chain)
122
- amount_to_pool = native_balance
123
- else:
124
- chain_instance = get_chain_instance(chain)
125
- web3 = init_web3(chain_instance, account.proxy)
126
- amount_to_pool = get_balance_to_pool(token, chain_instance, web3)
127
- amount_to_pool = amount_to_pool.minus(self.min_native_balance)
128
- else:
129
- chain_instance = get_chain_instance(chain)
130
- web3 = init_web3(chain_instance, account.proxy)
131
- amount_to_pool = get_amount_to_bridge_usdc(
132
- bridge_amount_interval) if token == 'USDC' else interval_to_eth_balance(bridge_amount_interval, account,
133
- chain_instance['chain'], web3)
134
-
135
- logger.info(f"Adding to stargate {chain_instance['chain']} pool")
136
- add_to_pool(account, amount_to_pool, token, chain_instance, web3)
137
-
138
- def get_farm_balances(self, account, token, chains):
139
-
140
- def get_balance_for_chain(chain):
141
- web3 = init_web3(get_chain_instance(chain), account.proxy)
142
- farming_address = get_contracts_for_chain(chain)['STARGATE_FARMING']
143
- farming = StargateFarming(farming_address, web3)
144
-
145
- if token == 'USDC':
146
- return chain, Erc20Balance(farming.user_info(account), chain, token), web3
147
- else:
148
- return chain, NativeBalance(farming.user_info(account), chain, token), web3
149
-
150
- return [get_balance_for_chain(chain) for chain in chains]
151
-
152
- def log(self):
153
- return "STARGATE FARMING"
154
-
155
- def parse_params(self, module_params):
156
- return (
157
- module_params['bridge_amount_interval'],
158
- module_params['chain'],
159
- module_params['operation'],
160
- module_params['all_balance_mode'],
161
- module_params['token'],
162
- module_params['operation_sleep_interval']
163
- )
@@ -1,10 +0,0 @@
1
- l0_chain_ids = {
2
- 'ARBITRUM': 110,
3
- 'OPTIMISM': 111,
4
- 'ZKSYNC': 165,
5
- 'ARBITRUM_NOVA': 175,
6
- 'LINEA': 183,
7
- 'BASE': 184,
8
- 'SCROLL': 214,
9
- 'POLYGON': 109
10
- }
@@ -1,74 +0,0 @@
1
- from loguru import logger
2
- from sybil_engine.data.contracts import get_contracts_for_chain
3
- from sybil_engine.data.networks import get_chain_instance
4
- from sybil_engine.domain.balance.balance_utils import get_native_balance
5
- from sybil_engine.domain.balance.tokens import Erc20Token
6
- from sybil_engine.utils.utils import ModuleException
7
- from sybil_engine.utils.web3_utils import init_web3
8
-
9
- from web3_wizzard_lib.core.contract.stargate_router import StargateRouter
10
- from web3_wizzard_lib.core.contract.stargate_router_eth import StargateRouterEth
11
- from web3_wizzard_lib.core.modules import StargatePoolToken
12
-
13
-
14
- def add_to_pool(account, amount_to_pool, bridge_token, chain_instance, web3):
15
- def get_router_details(token_type, chain_inst):
16
- contracts = get_contracts_for_chain(chain_inst['chain'])
17
- if token_type == 'ETH':
18
- return StargateRouterEth(contracts["STARGATE_ROUTER_ETH"], web3), None
19
- else:
20
- erc20 = Erc20Token(chain_inst['chain'], token_type, web3)
21
-
22
- if erc20.allowance(account, contracts["STARGATE_ROUTER"]) < erc20.balance(account).wei:
23
- erc20.approve(account, contracts["STARGATE_ROUTER"])
24
- return StargateRouter(contracts["STARGATE_ROUTER"], web3), erc20
25
-
26
- logger.info(f"======= Adding liquidity {bridge_token} {chain_instance['chain']} ::: {account.address} =======")
27
-
28
- native_balance = get_native_balance(account, web3, chain_instance)
29
- logger.info(f"Native balance: {native_balance}")
30
-
31
- stargate_router, erc20 = get_router_details(bridge_token, chain_instance)
32
-
33
- balance = native_balance if bridge_token == 'ETH' else erc20.balance(account)
34
- if bridge_token != 'ETH':
35
- logger.info(f"Balance: {balance}")
36
-
37
- verify_balance(amount_to_pool, balance, native_balance)
38
-
39
- func = stargate_router.add_liquidity_eth if bridge_token == 'ETH' else stargate_router.add_liquidity
40
-
41
- logger.info(f"Pooling: {amount_to_pool}")
42
- func(account, amount_to_pool)
43
-
44
-
45
- def verify_balance(amount_to_pool, balance, erc20_token):
46
- if amount_to_pool.wei > balance.wei:
47
- raise Exception(f"Account balance ({amount_to_pool}) is lower than amount to pool.")
48
-
49
- if balance.wei == 0:
50
- logger.info(f"{erc20_token.token} balance is 0")
51
- raise ModuleException("")
52
-
53
-
54
- def find_max_pool_chain(balances):
55
- max_usdc_balance = max(balances, key=lambda x: x[1].wei)
56
-
57
- if max_usdc_balance[1] == 0:
58
- raise Exception("Can't bridge tokens, all chain USDC balances are zero")
59
-
60
- return max_usdc_balance
61
-
62
-
63
- def get_pool_token_name(token_type):
64
- return 'STARGATE_ETH_POOL' if token_type == 'ETH' else 'STARGATE_USDT_POOL'
65
-
66
-
67
- def get_pool_balances(token, account, chains):
68
- return [get_pool_balance_for_chain(chain, token, account) for chain in chains]
69
-
70
-
71
- def get_pool_balance_for_chain(chain, pool_token_name, account):
72
- web3 = init_web3(get_chain_instance(chain), account.proxy)
73
- pool_token_instance = StargatePoolToken(chain, get_pool_token_name(pool_token_name), web3)
74
- return chain, pool_token_instance.balance(account), web3
@@ -1,25 +0,0 @@
1
- from sybil_engine.data.tokens import get_tokens_for_chain
2
- from sybil_engine.domain.balance.balance import Erc20Balance, NativeBalance
3
-
4
- from web3_wizzard_lib.core import StargateTokenPool
5
-
6
-
7
- class StargatePoolToken:
8
- def __init__(self, chain, token, web3):
9
- self.chain = chain
10
- self.token = token
11
- self.web3 = web3
12
- self.token_pool_contract = StargateTokenPool(get_tokens_for_chain(self.chain)[self.token], self.web3)
13
-
14
- def balance(self, account):
15
- if self.token == 'STARGATE_USDC_POOL':
16
- return Erc20Balance(self.token_pool_contract.balance_of(account), self.chain, self.token)
17
- else:
18
- return NativeBalance(self.token_pool_contract.balance_of(account), self.chain, self.token)
19
-
20
- def approve(self, account, contract_on_approve):
21
- return self.token_pool_contract.approve(account, contract_on_approve)
22
-
23
- def allowance(self, account, allowance_contract):
24
- return self.token_pool_contract.allowance(account, allowance_contract)
25
-
@@ -1,68 +0,0 @@
1
- import functools
2
-
3
- from loguru import logger
4
- from sybil_engine.data.contracts import get_contracts_for_chain
5
- from sybil_engine.domain.balance.balance import NativeBalance, NotEnoughNativeBalance
6
- from sybil_engine.domain.balance.balance_utils import get_native_balance, from_eth_to_wei
7
- from sybil_engine.utils.l0_utils import L0FeeToHigh
8
- from sybil_engine.utils.utils import randomized_sleeping
9
-
10
-
11
- def stargate_check_gas(token):
12
- def decorator(func):
13
- @functools.wraps(func)
14
- def wrapper(self, *args):
15
- check_gas(token, self.chain_instance, args[-1], args[0], self.web3)
16
- return func(self, *args)
17
-
18
- return wrapper
19
-
20
- return decorator
21
-
22
-
23
- def check_gas(token, chain_instance, to_chain_instance, account, web3):
24
- while True:
25
- try:
26
- verify_stargate_fee(token, chain_instance, to_chain_instance, account, web3)
27
- return
28
- except L0FeeToHigh as e:
29
- logger.info(e)
30
- randomized_sleeping({'from': 60 * 4, 'to': 60 * 8})
31
- except Exception as e:
32
- raise StargateBridgeException("Stargate bridge error") from e
33
-
34
-
35
- def verify_stargate_fee(token, from_chain_instance, to_chain_instance, account, web3):
36
- native_balance = get_native_balance(account, web3, from_chain_instance)
37
- native_fee_balance = get_native_fee_balance(token, native_balance, from_chain_instance, to_chain_instance, account,
38
- web3)
39
-
40
- logger.info(f"Native LayerZero fee: {native_fee_balance.log_line()}")
41
- if native_fee_balance.wei > native_balance.wei:
42
- raise NotEnoughNativeBalance(
43
- f"Native balance ({native_balance.log_line()}) < Native LayerZero required fee")
44
- if native_fee_balance.wei > from_eth_to_wei(from_chain_instance['max_l0_fee']):
45
- raise L0FeeToHigh(f"Native LayerZero fee is to high")
46
-
47
-
48
- def get_native_fee_balance(token, native_balance, from_chain_instance, to_chain_instance, account, web3):
49
- chain_contracts = get_contracts_for_chain(from_chain_instance['chain'])
50
-
51
- if token in ['ETH', 'USDC']:
52
- from web3_wizzard_lib.core.contract.stargate_router import StargateRouter
53
- stargate_router = StargateRouter(chain_contracts["STARGATE_ROUTER"], web3)
54
-
55
- wei_balance = stargate_router.count_native_fee_stargate(
56
- to_chain_instance['stargate_chain_id'],
57
- account.address
58
- )
59
- else:
60
- raise Exception("Token not supported")
61
-
62
- return NativeBalance(wei_balance, native_balance.chain, native_balance.token)
63
-
64
-
65
- class StargateBridgeException(Exception):
66
- def __init__(self, message):
67
- self.message = message
68
- super().__init__(self.message)
@@ -1 +0,0 @@
1
-
@@ -1,38 +0,0 @@
1
- from sybil_engine.domain.dex import Dex
2
-
3
- from web3_wizzard_lib.core.contract.horizondex_router import HorizonDexRouter
4
- from ...contract.horizondex_quoter import HorizonDexQuoter
5
-
6
-
7
- class Horizondex(Dex):
8
- dex_name = 'horizondex'
9
- swap_contract = 'HORIZONDEX'
10
- supported_chains = ['BASE', 'LINEA']
11
-
12
- def __init__(self, chain_instance, web3):
13
- super().__init__(chain_instance, web3)
14
- self.weth_address = self.tokens['WETH']
15
- self.horizondex_router = HorizonDexRouter(self.chain_contracts[self.swap_contract], self.web3)
16
-
17
- def swap_token_for_native(self, account, amount_to_swap, from_token_address, slippage):
18
- amount_out_min = int(self.get_amount_out_min(amount_to_swap, from_token_address, self.weth_address) * slippage)
19
- args = [account, amount_to_swap, amount_out_min, from_token_address, self.weth_address]
20
- func = self.horizondex_router.multicall
21
-
22
- return args, func
23
-
24
- def swap_native_for_token(self, account, amount_to_swap, slippage, to_token_address):
25
- amount_out_min = int(self.get_amount_out_min(amount_to_swap, self.weth_address, to_token_address) * slippage)
26
- args = [account, amount_to_swap, amount_out_min, self.weth_address, to_token_address]
27
- func = self.horizondex_router.swap_exact_input_single
28
-
29
- return args, func
30
-
31
- def swap_token_for_token(self, account, amount_to_swap, slippage, from_token_address, to_token_address):
32
- raise Exception("Not supported yet")
33
-
34
- def get_amount_out_min(self, amount_to_swap, from_token_address, to_token_address):
35
- horizondex_quoter_contract = self.chain_contracts["HORIZONDEX_QUOTER"]
36
- horizondex_quoter = HorizonDexQuoter(horizondex_quoter_contract, self.web3)
37
-
38
- return horizondex_quoter.quote_exact_input_single(amount_to_swap.wei, from_token_address, to_token_address)
@@ -1,41 +0,0 @@
1
- from sybil_engine.domain.dex import Dex
2
-
3
- from ...contract.izumi import IzumiRouter
4
-
5
-
6
- class Izumi(Dex):
7
- dex_name = 'izumi'
8
- swap_contract = 'IZUMI'
9
- supported_chains = ['LINEA']
10
-
11
- def __init__(self, chain_instance, web3):
12
- super().__init__(chain_instance, web3)
13
- self.weth_address = self.tokens['WETH']
14
- self.izumi = IzumiRouter(self.chain_contracts[self.swap_contract], self.web3)
15
-
16
- def swap_token_for_native(self, account, amount_to_swap, from_token_address, slippage):
17
- amount_out_min = int(self.get_amount_out_min(amount_to_swap, from_token_address, self.weth_address) * slippage)
18
- args = [account, amount_to_swap, amount_out_min, from_token_address, self.weth_address]
19
- func = self.izumi.multicall
20
-
21
- return args, func
22
-
23
- def swap_native_for_token(self, account, amount_to_swap, slippage, to_token_address):
24
- amount_out_min = int(self.get_amount_out_min(amount_to_swap, self.weth_address, to_token_address) * slippage)
25
- args = [account, amount_to_swap, amount_out_min, self.weth_address, to_token_address]
26
- func = self.izumi.multicall
27
-
28
- return args, func
29
-
30
- def swap_token_for_token(self, account, amount_to_swap, slippage, from_token_address, to_token_address):
31
- raise Exception("Not supported yet")
32
-
33
- def get_amount_out_min(self, amount_to_swap, from_token_address, to_token_address):
34
- izumi = self.chain_contracts["IZUMI"]
35
- izumi_router = IzumiRouter(izumi, self.web3)
36
-
37
- if amount_to_swap.token == 'ETH':
38
- return int((izumi_router.quote_price('weETH') * amount_to_swap.wei) * 0.999)
39
- else:
40
- return int((izumi_router.quote_price('ETH') * amount_to_swap.wei) * 0.999)
41
-
@@ -1,34 +0,0 @@
1
- from sybil_engine.domain.dex import Dex
2
-
3
- from web3_wizzard_lib.core.contract.lineaswaprouter import LineaSwapRouter
4
-
5
-
6
- class LineaSwap(Dex):
7
- dex_name = 'lineaswap'
8
- swap_contract = "LINEASWAP"
9
- supported_chains = ['BASE', 'LINEA']
10
-
11
- def __init__(self, chain_instance, web3):
12
- super().__init__(chain_instance, web3)
13
- self.linea_swap_router = LineaSwapRouter(self.chain_contracts[self.swap_contract], self.web3)
14
- self.weth_address = self.tokens['WETH']
15
-
16
- def swap_native_for_token(self, account, amount_to_swap, slippage, to_token_address):
17
- amount_out_min = int(self.get_amount_out_min(amount_to_swap, self.weth_address, to_token_address) * slippage)
18
- args = [account, amount_to_swap, self.weth_address, to_token_address, amount_out_min]
19
- func = self.linea_swap_router.swap_exact_eth_for_tokens
20
-
21
- return args, func
22
-
23
- def swap_token_for_native(self, account, amount_to_swap, from_token_address, slippage):
24
- amount_out_min = int(self.get_amount_out_min(amount_to_swap, from_token_address, self.weth_address) * slippage)
25
- args = [account, amount_to_swap, from_token_address, self.weth_address, amount_out_min]
26
- func = self.linea_swap_router.swap_exact_tokens_for_eth
27
-
28
- return args, func
29
-
30
- def swap_token_for_token(self, account, amount_to_swap, slippage, from_token_address, to_token_address):
31
- raise Exception("Not supported")
32
-
33
- def get_amount_out_min(self, amount_to_swap, from_token_address, to_token_address):
34
- return self.linea_swap_router.get_amount_out(amount_to_swap, from_token_address, to_token_address)
@@ -1,66 +0,0 @@
1
- from sybil_engine.domain.balance.tokens import Erc20Token
2
- from sybil_engine.domain.dex import Dex
3
-
4
- from web3_wizzard_lib.core.contract.maverick_multicall import MaverickMulticall
5
- from ...contract.pancake_pool import PancakePool
6
- from ...contract.pancake_quoter import PancakeQuoter
7
-
8
- pool_addresses = {
9
- 'ZKSYNC': {
10
- "ETH>USDC": "0x41c8cf74c27554a8972d3bf3d2bd4a14d8b604ab"
11
- },
12
- 'BASE': {
13
- "ETH>USDbC": "0x06e6736ca9e922766279a22b75a600fe8b8473b6",
14
- "ETH>USDC": "0x06e6736ca9e922766279a22b75a600fe8b8473b6"
15
- }
16
- }
17
-
18
-
19
- class Maverick(Dex):
20
- dex_name = 'maverick'
21
- swap_contract = 'MAV_ROUTER'
22
- supported_chains = ['ZKSYNC', 'BASE']
23
-
24
- def __init__(self, chain_instance, web3):
25
- self.chain_instance = chain_instance
26
- super().__init__(chain_instance, web3)
27
- self.weth_contract = self.tokens['WETH']
28
- self.pancake_pool = PancakePool(self.chain_contracts["PANCAKE_FACTORY"], self.web3)
29
- self.maverick_router = MaverickMulticall(self.chain_contracts[self.swap_contract], self.web3)
30
-
31
- def swap_native_for_token(self, account, amount_to_swap, slippage, to_token_address):
32
- erc20_token = Erc20Token(self.chain_instance['chain'], to_token_address, self.web3)
33
- pair_name = f"{self.chain_instance['gas_token']}>{erc20_token.symbol()}"
34
- maverick_pool_address = pool_addresses[self.chain_instance['chain']][pair_name]
35
-
36
- pool = self.pancake_pool.get_pool(self.weth_contract, to_token_address)
37
-
38
- if pool == self.tokens['ZERO_ADDRESS']:
39
- raise Exception(f"[{account.address}] Swap path {self.weth_contract} to {to_token_address} not found!")
40
-
41
- amount_out = int(self.get_amount_out_min(amount_to_swap, self.weth_contract, to_token_address) * slippage)
42
-
43
- args = [account, amount_to_swap, amount_out, self.weth_contract, maverick_pool_address, to_token_address]
44
-
45
- return args, self.maverick_router.multicall
46
-
47
- def swap_token_for_native(self, account, amount_to_swap, from_token_address, slippage):
48
- pair_name = f'{self.chain_instance["gas_token"]}>{amount_to_swap.token}'
49
- maverick_pool_address = pool_addresses[self.chain_instance['chain']][pair_name]
50
-
51
- pool = self.pancake_pool.get_pool(from_token_address, self.weth_contract)
52
-
53
- if pool == self.tokens['ZERO_ADDRESS']:
54
- raise Exception(f"[{account.address}] Swap path {from_token_address} to {self.weth_contract} not found!")
55
-
56
- amount_out = int(self.get_amount_out_min(amount_to_swap, from_token_address, self.weth_contract) * slippage)
57
-
58
- args = [account, amount_to_swap, amount_out, from_token_address, maverick_pool_address, self.weth_contract]
59
-
60
- return args, self.maverick_router.multicall
61
-
62
- def get_amount_out_min(self, amount_to_swap, token_in_address, token_out_address):
63
- pancake_quoter_contract = self.chain_contracts["PANCAKE_QUOTER"]
64
- pancake_quoter = PancakeQuoter(pancake_quoter_contract, self.web3)
65
-
66
- return pancake_quoter.quote_exact_input_single(token_in_address, token_out_address, amount_to_swap.wei)