web3-wizzard-lib 1.6.12__py3-none-any.whl → 1.6.15__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 (267) hide show
  1. web3_wizzard_lib/core/__init__.py +1 -0
  2. web3_wizzard_lib/core/contract/__init__.py +0 -0
  3. web3_wizzard_lib/core/contract/aavecontract.py +36 -0
  4. web3_wizzard_lib/core/contract/alienswap_contract.py +21 -0
  5. web3_wizzard_lib/core/contract/arena_games_contract.py +16 -0
  6. web3_wizzard_lib/core/contract/basiliskcontract.py +58 -0
  7. web3_wizzard_lib/core/contract/bilinear_contract.py +22 -0
  8. web3_wizzard_lib/core/contract/bungee.py +33 -0
  9. web3_wizzard_lib/core/contract/coredao_contract.py +34 -0
  10. web3_wizzard_lib/core/contract/coredao_from_contract.py +40 -0
  11. web3_wizzard_lib/core/contract/dmail_send_mail.py +18 -0
  12. web3_wizzard_lib/core/contract/empty_nft.py +18 -0
  13. web3_wizzard_lib/core/contract/era_name.py +23 -0
  14. web3_wizzard_lib/core/contract/eralendcontract.py +34 -0
  15. web3_wizzard_lib/core/contract/eth_scroll_bridge_contract.py +25 -0
  16. web3_wizzard_lib/core/contract/frog_war_contract.py +48 -0
  17. web3_wizzard_lib/core/contract/gmx_reward_router.py +22 -0
  18. web3_wizzard_lib/core/contract/horizondex_quoter.py +14 -0
  19. web3_wizzard_lib/core/contract/horizondex_router.py +91 -0
  20. web3_wizzard_lib/core/contract/imagine_contract.py +18 -0
  21. web3_wizzard_lib/core/contract/izumi.py +63 -0
  22. web3_wizzard_lib/core/contract/kreatorland_contract.py +21 -0
  23. web3_wizzard_lib/core/contract/l0_claim.py +254 -0
  24. web3_wizzard_lib/core/contract/l2_telegraph.py +21 -0
  25. web3_wizzard_lib/core/contract/layerbank_price.py +18 -0
  26. web3_wizzard_lib/core/contract/layerbank_token.py +29 -0
  27. web3_wizzard_lib/core/contract/layerbankcontract.py +59 -0
  28. web3_wizzard_lib/core/contract/linea_day_2_contract.py +19 -0
  29. web3_wizzard_lib/core/contract/linea_day_3_contract.py +55 -0
  30. web3_wizzard_lib/core/contract/linea_ens_names_contract.py +55 -0
  31. web3_wizzard_lib/core/contract/lineaswaprouter.py +52 -0
  32. web3_wizzard_lib/core/contract/maverick_multicall.py +52 -0
  33. web3_wizzard_lib/core/contract/mendi_finance_contract.py +11 -0
  34. web3_wizzard_lib/core/contract/mendi_token.py +25 -0
  35. web3_wizzard_lib/core/contract/merkly_minter.py +47 -0
  36. web3_wizzard_lib/core/contract/micro3_contract.py +18 -0
  37. web3_wizzard_lib/core/contract/mute_router.py +93 -0
  38. web3_wizzard_lib/core/contract/new_rage_contract.py +31 -0
  39. web3_wizzard_lib/core/contract/nidum_contract.py +44 -0
  40. web3_wizzard_lib/core/contract/nile_contract.py +60 -0
  41. web3_wizzard_lib/core/contract/nomis_attest_contract.py +40 -0
  42. web3_wizzard_lib/core/contract/nomis_contract.py +40 -0
  43. web3_wizzard_lib/core/contract/octomos.py +31 -0
  44. web3_wizzard_lib/core/contract/odos.py +104 -0
  45. web3_wizzard_lib/core/contract/omnisea.py +29 -0
  46. web3_wizzard_lib/core/contract/orbiter_starknet.py +30 -0
  47. web3_wizzard_lib/core/contract/pancake_pool.py +19 -0
  48. web3_wizzard_lib/core/contract/pancake_quoter.py +20 -0
  49. web3_wizzard_lib/core/contract/pancake_router.py +72 -0
  50. web3_wizzard_lib/core/contract/rage_claim.py +24 -0
  51. web3_wizzard_lib/core/contract/reactor_fusion_contract.py +78 -0
  52. web3_wizzard_lib/core/contract/readon_contract.py +19 -0
  53. web3_wizzard_lib/core/contract/rubyscore_contract.py +31 -0
  54. web3_wizzard_lib/core/contract/satoshi_universe_contract.py +29 -0
  55. web3_wizzard_lib/core/contract/scroll_bridge_contract.py +24 -0
  56. web3_wizzard_lib/core/contract/scroll_canvas_mint_contract.py +26 -0
  57. web3_wizzard_lib/core/contract/scroll_oracle.py +11 -0
  58. web3_wizzard_lib/core/contract/snap_contract.py +16 -0
  59. web3_wizzard_lib/core/contract/social_scan_contract.py +20 -0
  60. web3_wizzard_lib/core/contract/stargate_farming.py +37 -0
  61. web3_wizzard_lib/core/contract/stargate_router.py +84 -0
  62. web3_wizzard_lib/core/contract/stargate_router_eth.py +41 -0
  63. web3_wizzard_lib/core/contract/stargate_token_pool.py +45 -0
  64. web3_wizzard_lib/core/contract/stargate_v2_contract.py +36 -0
  65. web3_wizzard_lib/core/contract/syncswap_classic_pool.py +15 -0
  66. web3_wizzard_lib/core/contract/syncswap_classic_pool_factory.py +15 -0
  67. web3_wizzard_lib/core/contract/syncswap_pool.py +25 -0
  68. web3_wizzard_lib/core/contract/syncswap_router.py +123 -0
  69. web3_wizzard_lib/core/contract/tavaera_id.py +18 -0
  70. web3_wizzard_lib/core/contract/tavaera_mint.py +17 -0
  71. web3_wizzard_lib/core/contract/townstory_bonus_contract.py +19 -0
  72. web3_wizzard_lib/core/contract/townstory_contract.py +21 -0
  73. web3_wizzard_lib/core/contract/velocore_lens.py +44 -0
  74. web3_wizzard_lib/core/contract/velocore_pool.py +198 -0
  75. web3_wizzard_lib/core/contract/velocore_router.py +80 -0
  76. web3_wizzard_lib/core/contract/woofi_swap.py +29 -0
  77. web3_wizzard_lib/core/contract/xy_finance_contract.py +87 -0
  78. web3_wizzard_lib/core/contract/yoddlo_contract.py +19 -0
  79. web3_wizzard_lib/core/contract/yuliverse_contract.py +36 -0
  80. web3_wizzard_lib/core/contract/zebra_contract.py +68 -0
  81. web3_wizzard_lib/core/contract/zerolend_contract.py +34 -0
  82. web3_wizzard_lib/core/contract/zerolend_liq_contract.py +20 -0
  83. web3_wizzard_lib/core/contract/zkdx_contract.py +40 -0
  84. web3_wizzard_lib/core/contract/zkdx_data.py +14 -0
  85. web3_wizzard_lib/core/contract/zks.py +24 -0
  86. web3_wizzard_lib/core/modules/__init__.py +0 -0
  87. web3_wizzard_lib/core/modules/ads_import_proxy.py +52 -0
  88. web3_wizzard_lib/core/modules/airdrop_printer.py +81 -0
  89. web3_wizzard_lib/core/modules/bank/__init__.py +0 -0
  90. web3_wizzard_lib/core/modules/bank/aave.py +25 -0
  91. web3_wizzard_lib/core/modules/bank/bank.py +15 -0
  92. web3_wizzard_lib/core/modules/bank/basilisk.py +25 -0
  93. web3_wizzard_lib/core/modules/bank/eralend.py +25 -0
  94. web3_wizzard_lib/core/modules/bank/layerbank.py +116 -0
  95. web3_wizzard_lib/core/modules/bank/mendi_finance.py +57 -0
  96. web3_wizzard_lib/core/modules/bank/reactorfusion.py +25 -0
  97. web3_wizzard_lib/core/modules/bank/zerolend.py +36 -0
  98. web3_wizzard_lib/core/modules/bank_module.py +99 -0
  99. web3_wizzard_lib/core/modules/bridge/__init__.py +0 -0
  100. web3_wizzard_lib/core/modules/bridge/bridge.py +8 -0
  101. web3_wizzard_lib/core/modules/bridge/coredao_bridge_sub.py +47 -0
  102. web3_wizzard_lib/core/modules/bridge/orbiter_sub.py +112 -0
  103. web3_wizzard_lib/core/modules/bridge/scroll_bridge_sub.py +42 -0
  104. web3_wizzard_lib/core/modules/bridge/stargate_v2_sub.py +74 -0
  105. web3_wizzard_lib/core/modules/bridge_module.py +47 -0
  106. web3_wizzard_lib/core/modules/bungee.py +109 -0
  107. web3_wizzard_lib/core/modules/cex_sender.py +60 -0
  108. web3_wizzard_lib/core/modules/cex_subaccount_transfer.py +34 -0
  109. web3_wizzard_lib/core/modules/cex_withdraw.py +91 -0
  110. web3_wizzard_lib/core/modules/claimer.py +45 -0
  111. web3_wizzard_lib/core/modules/claims/__init__.py +0 -0
  112. web3_wizzard_lib/core/modules/claims/layerzero_claimer.py +64 -0
  113. web3_wizzard_lib/core/modules/claims/rabby_claimer.py +81 -0
  114. web3_wizzard_lib/core/modules/concrete_swap.py +108 -0
  115. web3_wizzard_lib/core/modules/coredao_bridge.py +32 -0
  116. web3_wizzard_lib/core/modules/coredao_bridge_auto.py +39 -0
  117. web3_wizzard_lib/core/modules/debank_checker.py +78 -0
  118. web3_wizzard_lib/core/modules/dmail.py +54 -0
  119. web3_wizzard_lib/core/modules/erc20_balance.py +42 -0
  120. web3_wizzard_lib/core/modules/gmx_reward.py +25 -0
  121. web3_wizzard_lib/core/modules/intract/__init__.py +0 -0
  122. web3_wizzard_lib/core/modules/intract/intract_api.py +212 -0
  123. web3_wizzard_lib/core/modules/intract/utils.py +81 -0
  124. web3_wizzard_lib/core/modules/intract_claim.py +101 -0
  125. web3_wizzard_lib/core/modules/layer_2_20.py +65 -0
  126. web3_wizzard_lib/core/modules/lending_module.py +134 -0
  127. web3_wizzard_lib/core/modules/linea_appeal.py +98 -0
  128. web3_wizzard_lib/core/modules/linea_poh_lxp.py +65 -0
  129. web3_wizzard_lib/core/modules/liquidity/__init__.py +0 -0
  130. web3_wizzard_lib/core/modules/liquidity/nile_pool.py +64 -0
  131. web3_wizzard_lib/core/modules/liquidity/pool.py +16 -0
  132. web3_wizzard_lib/core/modules/liquidity/syncswap_pool.py +61 -0
  133. web3_wizzard_lib/core/modules/liquidity/velocore_pool.py +55 -0
  134. web3_wizzard_lib/core/modules/liquidity/zerolend_liquidity.py +26 -0
  135. web3_wizzard_lib/core/modules/liquidity_pool.py +60 -0
  136. web3_wizzard_lib/core/modules/merkly_refuel.py +87 -0
  137. web3_wizzard_lib/core/modules/new_rage_withdraw.py +41 -0
  138. web3_wizzard_lib/core/modules/nft/__init__.py +0 -0
  139. web3_wizzard_lib/core/modules/nft/abbys_world.py +22 -0
  140. web3_wizzard_lib/core/modules/nft/acg_worlds.py +25 -0
  141. web3_wizzard_lib/core/modules/nft/alienswap_linea.py +22 -0
  142. web3_wizzard_lib/core/modules/nft/arena_games.py +22 -0
  143. web3_wizzard_lib/core/modules/nft/asmatch.py +22 -0
  144. web3_wizzard_lib/core/modules/nft/battlemon.py +25 -0
  145. web3_wizzard_lib/core/modules/nft/bilinear.py +22 -0
  146. web3_wizzard_lib/core/modules/nft/bitavatar.py +25 -0
  147. web3_wizzard_lib/core/modules/nft/culture_satoshi_universe.py +24 -0
  148. web3_wizzard_lib/core/modules/nft/efrogs.py +26 -0
  149. web3_wizzard_lib/core/modules/nft/empty_nft.py +22 -0
  150. web3_wizzard_lib/core/modules/nft/era_domain.py +42 -0
  151. web3_wizzard_lib/core/modules/nft/frog_war.py +22 -0
  152. web3_wizzard_lib/core/modules/nft/frog_war_bonus.py +22 -0
  153. web3_wizzard_lib/core/modules/nft/gamerboom.py +25 -0
  154. web3_wizzard_lib/core/modules/nft/gamerboom_bonus.py +26 -0
  155. web3_wizzard_lib/core/modules/nft/imagine.py +32 -0
  156. web3_wizzard_lib/core/modules/nft/kreatorland_module.py +35 -0
  157. web3_wizzard_lib/core/modules/nft/l2_telegraph_module.py +22 -0
  158. web3_wizzard_lib/core/modules/nft/layer3_meta.py +25 -0
  159. web3_wizzard_lib/core/modules/nft/linea_culture_2_2_linus.py +24 -0
  160. web3_wizzard_lib/core/modules/nft/linea_culture_2_3_yooldo.py +24 -0
  161. web3_wizzard_lib/core/modules/nft/linea_culture_2_4_frogwar.py +24 -0
  162. web3_wizzard_lib/core/modules/nft/linea_culture_2_5_acg.py +25 -0
  163. web3_wizzard_lib/core/modules/nft/linea_culture_2_6_ascend_the_end.py +25 -0
  164. web3_wizzard_lib/core/modules/nft/linea_culture_3_1_ascend_the_end.py +25 -0
  165. web3_wizzard_lib/core/modules/nft/linea_culture_3_2_sending_me.py +25 -0
  166. web3_wizzard_lib/core/modules/nft/linea_culture_3_3_townstory.py +25 -0
  167. web3_wizzard_lib/core/modules/nft/linea_culture_3_4_daniele.py +25 -0
  168. web3_wizzard_lib/core/modules/nft/linea_culture_3_5_demmortal.py +25 -0
  169. web3_wizzard_lib/core/modules/nft/linea_culture_3_6_foxy.py +25 -0
  170. web3_wizzard_lib/core/modules/nft/linea_culture_4_1_coop_records.py +60 -0
  171. web3_wizzard_lib/core/modules/nft/linea_culture_4_2_borja_moskv.py +65 -0
  172. web3_wizzard_lib/core/modules/nft/linea_culture_4_2_borja_moskv_approve.py +27 -0
  173. web3_wizzard_lib/core/modules/nft/linea_culture_4_3_fruit.py +66 -0
  174. web3_wizzard_lib/core/modules/nft/linea_culture_4_4_fruit_crux.py +67 -0
  175. web3_wizzard_lib/core/modules/nft/linea_culture_4_5_forbidden_fruit.py +67 -0
  176. web3_wizzard_lib/core/modules/nft/linea_culture_4_6_laurent.py +67 -0
  177. web3_wizzard_lib/core/modules/nft/linea_culture_day2.py +20 -0
  178. web3_wizzard_lib/core/modules/nft/linea_culture_day3.py +20 -0
  179. web3_wizzard_lib/core/modules/nft/linea_ens_names.py +107 -0
  180. web3_wizzard_lib/core/modules/nft/lucky_cat.py +25 -0
  181. web3_wizzard_lib/core/modules/nft/merkly_minter_module.py +22 -0
  182. web3_wizzard_lib/core/modules/nft/micro3.py +23 -0
  183. web3_wizzard_lib/core/modules/nft/mint_2048.py +28 -0
  184. web3_wizzard_lib/core/modules/nft/nft_submodule.py +16 -0
  185. web3_wizzard_lib/core/modules/nft/nidum.py +87 -0
  186. web3_wizzard_lib/core/modules/nft/nidum_bonus.py +23 -0
  187. web3_wizzard_lib/core/modules/nft/nomis.py +64 -0
  188. web3_wizzard_lib/core/modules/nft/nomis_attest.py +66 -0
  189. web3_wizzard_lib/core/modules/nft/nouns.py +27 -0
  190. web3_wizzard_lib/core/modules/nft/octomos.py +32 -0
  191. web3_wizzard_lib/core/modules/nft/omnisea.py +33 -0
  192. web3_wizzard_lib/core/modules/nft/omnizone.py +25 -0
  193. web3_wizzard_lib/core/modules/nft/orbiter_claim.py +87 -0
  194. web3_wizzard_lib/core/modules/nft/readon.py +30 -0
  195. web3_wizzard_lib/core/modules/nft/rubyscore.py +45 -0
  196. web3_wizzard_lib/core/modules/nft/sarubol.py +22 -0
  197. web3_wizzard_lib/core/modules/nft/satoshi_universe.py +22 -0
  198. web3_wizzard_lib/core/modules/nft/scroll_canvas_attest_year_badge.py +35 -0
  199. web3_wizzard_lib/core/modules/nft/scroll_canvas_mint.py +51 -0
  200. web3_wizzard_lib/core/modules/nft/sign.py +32 -0
  201. web3_wizzard_lib/core/modules/nft/snap.py +25 -0
  202. web3_wizzard_lib/core/modules/nft/snap_bonus.py +31 -0
  203. web3_wizzard_lib/core/modules/nft/social_scan.py +22 -0
  204. web3_wizzard_lib/core/modules/nft/tavaera.py +30 -0
  205. web3_wizzard_lib/core/modules/nft/townstory.py +75 -0
  206. web3_wizzard_lib/core/modules/nft/townstory_bonus.py +45 -0
  207. web3_wizzard_lib/core/modules/nft/trusta_reputation.py +48 -0
  208. web3_wizzard_lib/core/modules/nft/trustaa_poh.py +49 -0
  209. web3_wizzard_lib/core/modules/nft/uber_poh.py +24 -0
  210. web3_wizzard_lib/core/modules/nft/wizards_of_linea.py +26 -0
  211. web3_wizzard_lib/core/modules/nft/yoddlo.py +22 -0
  212. web3_wizzard_lib/core/modules/nft/yuliverse.py +22 -0
  213. web3_wizzard_lib/core/modules/nft/zace.py +25 -0
  214. web3_wizzard_lib/core/modules/nft/zks_domain.py +41 -0
  215. web3_wizzard_lib/core/modules/nft_minter.py +107 -0
  216. web3_wizzard_lib/core/modules/orbiter.py +39 -0
  217. web3_wizzard_lib/core/modules/orbiter_checker.py +26 -0
  218. web3_wizzard_lib/core/modules/rage.py +54 -0
  219. web3_wizzard_lib/core/modules/scroll_bridge.py +45 -0
  220. web3_wizzard_lib/core/modules/sell_all.py +51 -0
  221. web3_wizzard_lib/core/modules/sleep_module.py +25 -0
  222. web3_wizzard_lib/core/modules/smart_contract_deployment.py +37 -0
  223. web3_wizzard_lib/core/modules/stargate/__init__.py +0 -0
  224. web3_wizzard_lib/core/modules/stargate/auto_bridge.py +91 -0
  225. web3_wizzard_lib/core/modules/stargate/bridge.py +38 -0
  226. web3_wizzard_lib/core/modules/stargate/bridge_eth.py +59 -0
  227. web3_wizzard_lib/core/modules/stargate/bridge_tokens.py +48 -0
  228. web3_wizzard_lib/core/modules/stargate/classic_bridge.py +34 -0
  229. web3_wizzard_lib/core/modules/stargate/farming.py +163 -0
  230. web3_wizzard_lib/core/modules/stargate/l0_data.py +10 -0
  231. web3_wizzard_lib/core/modules/stargate/pool.py +74 -0
  232. web3_wizzard_lib/core/modules/stargate/stargate_balance_utils.py +25 -0
  233. web3_wizzard_lib/core/modules/stargate/stargate_gas_checker.py +68 -0
  234. web3_wizzard_lib/core/modules/swap/__init__.py +1 -0
  235. web3_wizzard_lib/core/modules/swap/horizondex.py +38 -0
  236. web3_wizzard_lib/core/modules/swap/izumi.py +41 -0
  237. web3_wizzard_lib/core/modules/swap/lineaswap.py +34 -0
  238. web3_wizzard_lib/core/modules/swap/maverick.py +66 -0
  239. web3_wizzard_lib/core/modules/swap/mute.py +39 -0
  240. web3_wizzard_lib/core/modules/swap/odos.py +58 -0
  241. web3_wizzard_lib/core/modules/swap/one_inch.py +58 -0
  242. web3_wizzard_lib/core/modules/swap/pancake.py +41 -0
  243. web3_wizzard_lib/core/modules/swap/swap_list.py +11 -0
  244. web3_wizzard_lib/core/modules/swap/syncswap.py +62 -0
  245. web3_wizzard_lib/core/modules/swap/velocore.py +40 -0
  246. web3_wizzard_lib/core/modules/swap/woofi.py +38 -0
  247. web3_wizzard_lib/core/modules/swap/xy_finance.py +43 -0
  248. web3_wizzard_lib/core/modules/swap/zebra.py +32 -0
  249. web3_wizzard_lib/core/modules/warm_up.py +98 -0
  250. web3_wizzard_lib/core/modules/wrapping.py +74 -0
  251. web3_wizzard_lib/core/modules/zkdx.py +63 -0
  252. web3_wizzard_lib/core/utils/__init__.py +0 -0
  253. web3_wizzard_lib/core/utils/ai_utils.py +45 -0
  254. web3_wizzard_lib/core/utils/benchmark_utils.py +12 -0
  255. web3_wizzard_lib/core/utils/module_memory.py +28 -0
  256. web3_wizzard_lib/core/utils/statistic_utils.py +150 -0
  257. web3_wizzard_lib/core/utils/sub_module.py +8 -0
  258. web3_wizzard_lib/data/__init__.py +0 -0
  259. web3_wizzard_lib/data/config_default.py +52 -0
  260. web3_wizzard_lib/data/module_config_default.py +209 -0
  261. web3_wizzard_lib/utils/__init__.py +0 -0
  262. web3_wizzard_lib/utils/debank_utils.py +19 -0
  263. {web3_wizzard_lib-1.6.12.dist-info → web3_wizzard_lib-1.6.15.dist-info}/METADATA +2 -2
  264. web3_wizzard_lib-1.6.15.dist-info/RECORD +369 -0
  265. web3_wizzard_lib-1.6.12.dist-info/RECORD +0 -107
  266. {web3_wizzard_lib-1.6.12.dist-info → web3_wizzard_lib-1.6.15.dist-info}/WHEEL +0 -0
  267. {web3_wizzard_lib-1.6.12.dist-info → web3_wizzard_lib-1.6.15.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,25 @@
1
+ from sybil_engine.contract.weth import WETH
2
+ from sybil_engine.data.networks import get_ids_chain
3
+ from sybil_engine.data.tokens import get_tokens_for_chain
4
+
5
+ from web3_wizzard_lib.core.contract.reactor_fusion_contract import ReactorFusionContract
6
+ from web3_wizzard_lib.core.modules.bank.bank import Bank
7
+
8
+
9
+ class ReactorFusion(Bank):
10
+ app_name = 'REACTORFUSION_LANDING'
11
+ supported_chains = ['ZKSYNC']
12
+
13
+ def __init__(self, contract, web3):
14
+ self.contract = ReactorFusionContract(contract, web3)
15
+
16
+ def supply(self, account, amount):
17
+ self.contract.mint(account, amount.wei)
18
+
19
+ def redeem(self, account, withdraw):
20
+ self.contract.redeem_underlying(account, withdraw.wei)
21
+
22
+ def get_deposit_amount(self, account, token):
23
+ weth_token = get_tokens_for_chain(get_ids_chain()[self.contract.web3.eth.chain_id])['REACTORFUSION_LANDING']
24
+
25
+ return WETH(weth_token, self.contract.web3).balance_of(account)
@@ -0,0 +1,36 @@
1
+ from loguru import logger
2
+ from sybil_engine.data.contracts import get_contracts_for_chain
3
+ from sybil_engine.data.tokens import get_tokens_for_chain
4
+ from sybil_engine.domain.balance.tokens import Erc20Token
5
+
6
+ from web3_wizzard_lib.core.contract.zerolend_contract import ZeroLendContract
7
+ from web3_wizzard_lib.core.modules.bank.bank import Bank
8
+
9
+
10
+ class ZeroLend(Bank):
11
+ app_name = 'ZEROLEND'
12
+ supported_chains = ['LINEA']
13
+
14
+ def __init__(self, chain, web3):
15
+ self.chain = chain
16
+ self.web3 = web3
17
+ self.contract = ZeroLendContract(get_contracts_for_chain(self.chain)['ZEROLEND_LEND'], self.web3)
18
+
19
+ def supply(self, account, amount):
20
+ logger.info(f"Deposit {amount} to ZEROLEND")
21
+
22
+ self.contract.deposit_eth(account, amount.wei)
23
+
24
+ def redeem(self, account, amount):
25
+ erc20_token = Erc20Token('LINEA', get_tokens_for_chain(self.chain)['ZEROLEND_WETH'], self.web3)
26
+
27
+ if erc20_token.allowance(account, self.contract.contract_address) < 100:
28
+ erc20_token.approve(account, self.contract.contract_address)
29
+
30
+ self.contract.withdraw_eth(account, amount.wei)
31
+
32
+ def get_deposit_amount(self, account, token):
33
+ erc20_token = Erc20Token('LINEA', get_tokens_for_chain(self.chain)['ZEROLEND_WETH'], self.web3)
34
+
35
+ return erc20_token.balance(account)
36
+
@@ -0,0 +1,99 @@
1
+ from loguru import logger
2
+ from sybil_engine.data.networks import get_chain_instance
3
+ from sybil_engine.domain.balance.balance_utils import get_native_balance, interval_to_eth_balance, \
4
+ interval_to_erc20_balance
5
+ from sybil_engine.module.module import Order, Module
6
+ from sybil_engine.utils.app_account_utils import AppAccount
7
+ from sybil_engine.utils.retry import retry
8
+ from sybil_engine.utils.utils import ConfigurationException
9
+ from sybil_engine.utils.web3_utils import init_web3
10
+
11
+ from web3_wizzard_lib.core.modules.bank.basilisk import Basilisk
12
+ from web3_wizzard_lib.core.modules.bank.eralend import Eralend
13
+ from web3_wizzard_lib.core.modules.bank.layerbank import LayerBank
14
+ from web3_wizzard_lib.core.modules.bank.mendi_finance import MendiFinance
15
+ from web3_wizzard_lib.core.modules.bank.aave import Aave
16
+ from web3_wizzard_lib.core.modules.bank.reactorfusion import ReactorFusion
17
+ from web3_wizzard_lib.core.modules.bank.zerolend import ZeroLend
18
+
19
+
20
+ class Banking(Module):
21
+ module_name = 'BANKING'
22
+ random_order = Order.RANDOM
23
+ module_config = 'banking_config'
24
+
25
+ @retry(max_attempts=10, retry_interval={'from': 10, 'to': 20})
26
+ def execute(self, bank_app_name, action, token, amount_interval, chain, account: AppAccount):
27
+ chain_instance = get_chain_instance(chain)
28
+ web3 = init_web3(chain_instance, account.proxy)
29
+ balance = get_native_balance(account, web3, chain_instance)
30
+
31
+ logger.info(f"Balance {balance}")
32
+
33
+ if token == 'ETH':
34
+ amount = interval_to_eth_balance(amount_interval, account, chain, web3)
35
+ else:
36
+ amount = interval_to_erc20_balance(amount_interval, account, token, chain, web3)
37
+
38
+ bank_app = self.get_bank_app(bank_app_name, chain, web3)
39
+
40
+ logger.info(f"{bank_app.app_name}")
41
+
42
+ self.perform_action(bank_app, action, amount, token, account)
43
+
44
+ def perform_action(self, bank_app, action, amount, token, account):
45
+ logger.info(action)
46
+ if action == 'SUPPLY':
47
+ bank_app.supply(account, amount)
48
+ elif action == 'BORROW':
49
+ bank_app.borrow(account, amount)
50
+ elif action == 'REPAY':
51
+ bank_app.repay_borrow(account, amount)
52
+ elif action == 'REDEEM':
53
+ amount = bank_app.get_deposit_amount(account, token)
54
+ logger.info(f"Redeem {amount} of {token} from {bank_app.app_name}")
55
+
56
+ bank_app.redeem(account, amount, token)
57
+ else:
58
+ raise ConfigurationException("Unsupported action")
59
+
60
+ def get_bank_app(self, bank_app, chain, web3):
61
+ bank_app = self.get_bank_app_by_name(bank_app)
62
+
63
+ if chain not in bank_app.supported_chains:
64
+ raise ConfigurationException(
65
+ f"{bank_app} not supported in {chain}. Supported chains: {bank_app.supported_chains}")
66
+
67
+ return bank_app(chain, web3)
68
+
69
+ def get_bank_app_by_name(self, bank_app_name):
70
+ for bank_app in self.get_bank_apps():
71
+ if bank_app.app_name == bank_app_name:
72
+ return bank_app
73
+ raise ConfigurationException(f"No Bank App with name {bank_app_name} found")
74
+
75
+ def get_bank_apps(self):
76
+ return {
77
+ Basilisk,
78
+ ReactorFusion,
79
+ Eralend,
80
+ MendiFinance,
81
+ LayerBank,
82
+ Aave,
83
+ ZeroLend
84
+ }
85
+
86
+ def log(self):
87
+ return "BANKING"
88
+
89
+ def parse_params(self, module_params):
90
+ if 'chain' not in module_params:
91
+ module_params['chain'] = 'LINEA'
92
+
93
+ return [
94
+ module_params['bank'],
95
+ module_params['action'],
96
+ module_params['token'],
97
+ module_params['amount_interval'],
98
+ module_params['chain']
99
+ ]
File without changes
@@ -0,0 +1,8 @@
1
+ class Bridge:
2
+ module_name = None
3
+
4
+ def execute(self, *args):
5
+ pass
6
+
7
+ def log(self):
8
+ pass
@@ -0,0 +1,47 @@
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 import NotEnoughERC20Balance
5
+ from sybil_engine.domain.balance.balance_utils import interval_to_erc20_balance, get_native_balance
6
+ from sybil_engine.domain.balance.tokens import Erc20Token
7
+ from sybil_engine.utils.retry import retry
8
+ from sybil_engine.utils.web3_utils import init_web3
9
+
10
+ from web3_wizzard_lib.core.contract.coredao_contract import CoreDaoContract
11
+ from web3_wizzard_lib.core.contract.coredao_from_contract import CoreDaoFromContract
12
+ from web3_wizzard_lib.core.modules.bridge.bridge import Bridge
13
+
14
+
15
+ class CoreDaoBridgeSubModule(Bridge):
16
+ supported_chains = ['POLYGON', 'COREDAO']
17
+
18
+ @retry(max_attempts=5, retry_interval={'from': 60 * 15, 'to': 60 * 25})
19
+ def execute(self, bridge_amount_interval, from_chain, to_chain, token, min_native_balance, account):
20
+ chain_instance = get_chain_instance(from_chain)
21
+ web3 = init_web3(chain_instance, account.proxy)
22
+
23
+ erc20_token = Erc20Token(from_chain, token, web3)
24
+
25
+ amount = interval_to_erc20_balance(bridge_amount_interval, account, token, from_chain, web3)
26
+
27
+ logger.info(f"Native balance: {get_native_balance(account, web3, chain_instance)}")
28
+ logger.info(f"Balance: {erc20_token.balance(account)}")
29
+
30
+ logger.info(f"Bridge {from_chain + ' -> ' + to_chain} {amount}")
31
+
32
+ if amount.wei == 0:
33
+ raise NotEnoughERC20Balance(f"Can't swap zero balance")
34
+
35
+ coredao_contract = get_contracts_for_chain(from_chain)['COREDAO_BRIDGE']
36
+
37
+ if erc20_token.allowance(account, coredao_contract) < amount.wei:
38
+ erc20_token.approve(account, coredao_contract)
39
+
40
+ if from_chain == 'COREDAO':
41
+ coredao = CoreDaoFromContract(coredao_contract, web3)
42
+ fee = coredao.estimate_bridge_fee(to_chain)
43
+ else:
44
+ coredao = CoreDaoContract(coredao_contract, web3)
45
+ fee = coredao.estimate_bridge_fee()
46
+
47
+ coredao.bridge(account, amount, erc20_token.erc20_contract.contract_address, fee, to_chain)
@@ -0,0 +1,112 @@
1
+ import random
2
+
3
+ from loguru import logger
4
+ from sybil_engine.contract.erc20contract import Erc20Contract
5
+ from sybil_engine.contract.send import Send
6
+ from sybil_engine.data.contracts import get_contracts_for_chain
7
+ from sybil_engine.data.networks import get_chain_instance
8
+ from sybil_engine.data.tokens import get_tokens_for_chain
9
+ from sybil_engine.domain.balance.balance import NotEnoughNativeBalance
10
+ from sybil_engine.domain.balance.balance_utils import interval_to_erc20_balance, \
11
+ interval_to_native_balance, verify_balance
12
+ from sybil_engine.utils.utils import ConfigurationException
13
+ from sybil_engine.utils.web3_utils import init_web3
14
+
15
+ from web3_wizzard_lib.core.contract.orbiter_starknet import OrbiterStarknet
16
+ from web3_wizzard_lib.core.modules.bridge.bridge import Bridge
17
+
18
+ bridge_codes = {
19
+ "ETH": 9001,
20
+ "ARBITRUM": 9002,
21
+ "POLYGON": 9006,
22
+ "OPTIMISM": 9007,
23
+ "BSC": 9015,
24
+ "ARBITRUM_NOVA": 9016,
25
+ "ZKSYNC": 9014,
26
+ "POLYGON_ZK": 9017,
27
+ "BASE": 9021,
28
+ "LINEA": 9023,
29
+ "SCROLL": 9019,
30
+ #"X_LAYER": 9027, DONT USE
31
+ "ZORA": 9030,
32
+ "MANTA": 9031,
33
+ "ZKFAIR": 9038
34
+ }
35
+
36
+
37
+ class OrbiterSubModule(Bridge):
38
+ supported_tokens = ['NATIVE', 'USDC', 'USDT', 'WETH']
39
+
40
+ def execute(self, bridge_amount_interval, from_chain, to_chain, token, min_native_balance, account):
41
+ from_chain_instance = get_chain_instance(from_chain)
42
+ web3 = init_web3(from_chain_instance, account.proxy)
43
+
44
+ if isinstance(to_chain, list):
45
+ to_chain = random.choice(to_chain)
46
+ if to_chain not in bridge_codes:
47
+ raise ConfigurationException(f"{to_chain} not supported in orbiter")
48
+
49
+ amount = self.__calculate_bridge_amount(account, bridge_amount_interval, from_chain_instance, to_chain, token,
50
+ min_native_balance, web3)
51
+
52
+ logger.info(f"Bridge {from_chain} –> {to_chain} | {amount}")
53
+ self.__perform_bridge(account, amount, from_chain, to_chain, token, web3)
54
+
55
+ def __perform_bridge(self, account, amount, from_chain, to_chain, token, web3):
56
+ if token == 'NATIVE':
57
+ self.__bridge_native(account, amount, from_chain, to_chain, web3)
58
+ else:
59
+ self.__bridge_token(account, amount, from_chain, web3)
60
+
61
+ def __calculate_bridge_amount(self, account, bridge_amount_interval, from_chain_instance, to_chain, token,
62
+ min_native_balance, web3):
63
+ if token == 'NATIVE':
64
+ native_without_min = verify_balance(min_native_balance, from_chain_instance, account, web3)
65
+
66
+ amount = interval_to_native_balance(bridge_amount_interval, account, from_chain_instance['chain'], web3)
67
+ if amount.wei > native_without_min.wei:
68
+ if bridge_amount_interval == 'all_balance':
69
+ amount = native_without_min
70
+ else:
71
+ raise NotEnoughNativeBalance(
72
+ f"The account balance ({native_without_min}) < bridging amount ({amount}).")
73
+ else:
74
+ amount = interval_to_erc20_balance(bridge_amount_interval, account, token, from_chain_instance['chain'],
75
+ web3)
76
+ if bridge_amount_interval == 'all_balance':
77
+ amount.wei = amount.wei - 10 ** 5
78
+
79
+ amount.wei = self.__adjust_amount_by_bridge_code(amount.wei, to_chain)
80
+
81
+ return amount
82
+
83
+ def __adjust_amount_by_bridge_code(self, wei_amount, to_chain):
84
+ bridge_code = bridge_codes.get(to_chain)
85
+ if not bridge_code:
86
+ raise ConfigurationException(f"No bridge code found for {to_chain}")
87
+ return int(f"{wei_amount // 10 ** 4}{bridge_code}")
88
+
89
+ def __bridge_native(self, account, amount, from_chain, to_chain, web3):
90
+ if to_chain == 'STARKNET':
91
+ if amount.readable() <= 0.0065 or amount.readable() >= 5:
92
+ raise NotEnoughNativeBalance(f"Limit range amount for starknet 0.0065 – 5 ETH | {amount}")
93
+
94
+ if from_chain != 'ZKSYNC':
95
+ raise ConfigurationException("only ZKSYNC can bridge to STARKNET")
96
+
97
+ orbiter_wallet = get_contracts_for_chain(from_chain)['ORBITER_STARKNET']
98
+ orbiter_starknet = OrbiterStarknet(orbiter_wallet, web3)
99
+ orbiter_starknet.bridge(account, amount)
100
+ else:
101
+ orbiter_wallet = get_contracts_for_chain(from_chain)['ORBITER']
102
+ send = Send(orbiter_wallet, web3)
103
+ send.send_to_wallet(account, orbiter_wallet, amount)
104
+
105
+ def __bridge_token(self, account, amount, from_chain, web3):
106
+ contracts = get_contracts_for_chain(from_chain)
107
+
108
+ if 'ORBITER_ERC20' not in contracts:
109
+ raise ConfigurationException(f"ERC20 is not supported for {from_chain}")
110
+
111
+ erc20 = Erc20Contract(get_tokens_for_chain(from_chain)[amount.token], web3)
112
+ erc20.transfer(account, amount, contracts['ORBITER_ERC20'])
@@ -0,0 +1,42 @@
1
+ from sybil_engine.utils.utils import ConfigurationException
2
+
3
+ from web3_wizzard_lib.core.modules.bridge.bridge import Bridge
4
+ from sybil_engine.data.contracts import get_contracts_for_chain
5
+ from sybil_engine.data.networks import get_chain_instance
6
+ from sybil_engine.domain.balance.balance import NotEnoughNativeBalance
7
+ from sybil_engine.domain.balance.balance_utils import interval_to_native_balance, verify_balance
8
+
9
+ from sybil_engine.utils.web3_utils import init_web3
10
+
11
+ from web3_wizzard_lib.core.contract.eth_scroll_bridge_contract import EthScrollBridgeContract
12
+ from web3_wizzard_lib.core.contract.scroll_bridge_contract import ScrollBridgeContract
13
+ from web3_wizzard_lib.core.contract.scroll_oracle import ScrollOracle
14
+
15
+ class ScrollBridgeSubModule(Bridge):
16
+
17
+ def execute(self, bridge_amount_interval, from_chain, to_chain, token, min_native_balance, account):
18
+ from_chain_instance = get_chain_instance(from_chain)
19
+ web3 = init_web3(from_chain_instance, account.proxy)
20
+ native_without_min = verify_balance(min_native_balance, from_chain_instance, account, web3)
21
+ amount = interval_to_native_balance(bridge_amount_interval, account, from_chain_instance['chain'], web3)
22
+ if amount.wei > native_without_min.wei:
23
+ if bridge_amount_interval == 'all_balance':
24
+ amount = native_without_min
25
+ else:
26
+ raise NotEnoughNativeBalance(
27
+ f"The account balance ({native_without_min}) < bridging amount ({amount}).")
28
+ if from_chain == 'ETH_MAINNET':
29
+ contract_oracle = get_contracts_for_chain(from_chain)["SCROLL_ORACLE"]
30
+ fee = ScrollOracle(contract_oracle, web3).estimateCrossDomainMessageFee()
31
+
32
+ scroll_bridge_contract_address = get_contracts_for_chain(from_chain)["SCROLL_BRIDGE"]
33
+ scroll_bridge = EthScrollBridgeContract(scroll_bridge_contract_address, web3)
34
+
35
+ scroll_bridge.sendMessage(account, amount.wei, fee)
36
+ elif from_chain == 'SCROLL':
37
+ scroll_bridge_contract_address = get_contracts_for_chain(from_chain)["SCROLL_BRIDGE"]
38
+ scroll_bridge = ScrollBridgeContract(scroll_bridge_contract_address, web3)
39
+
40
+ scroll_bridge.withdraw(account, amount.wei)
41
+ else:
42
+ raise ConfigurationException(f"{from_chain} chain is unsupported, only ETH_MAINNET and SCROLL allowed")
@@ -0,0 +1,74 @@
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 import NotEnoughNativeBalance
5
+ from sybil_engine.domain.balance.balance_utils import interval_to_native_balance, verify_balance
6
+ from sybil_engine.utils.utils import ConfigurationException
7
+ from sybil_engine.utils.web3_utils import init_web3
8
+
9
+ from web3_wizzard_lib.core.contract.stargate_v2_contract import StargateV2Contract
10
+ from web3_wizzard_lib.core.modules.bridge.bridge import Bridge
11
+
12
+ chain_ids = {
13
+ 'LINEA': 30183,
14
+ 'SCROLL': 30214,
15
+ 'OPTIMISM': 30111,
16
+ 'ARBITRUM': 30110,
17
+ 'BASE': 30184
18
+ }
19
+
20
+
21
+ class StargateV2SubModule(Bridge):
22
+ supported_tokens = ['NATIVE']
23
+
24
+ def execute(self, bridge_amount_interval, from_chain, to_chain, token, min_native_balance, account):
25
+ if token != 'NATIVE':
26
+ raise ConfigurationException('Currently only native token bridge is supported by Stargate V2')
27
+
28
+ from_chain_instance = get_chain_instance(from_chain)
29
+ web3 = init_web3(from_chain_instance, account.proxy)
30
+ stargate_v2_contract = get_contracts_for_chain(from_chain)['STARGATE_V2']
31
+
32
+ amount = self.__calculate_bridge_amount(
33
+ account,
34
+ bridge_amount_interval,
35
+ from_chain_instance,
36
+ min_native_balance,
37
+ web3
38
+ )
39
+
40
+ logger.info(f"Bridge {from_chain} –> {to_chain} | {amount}")
41
+
42
+ send_params = (
43
+ chain_ids[to_chain],
44
+ f'0x000000000000000000000000{account.address[2:]}',
45
+ amount.wei, # amountLD,
46
+ int(amount.wei * 0.995), # minAmountLd,
47
+ b'',
48
+ b'',
49
+ b'\x01',
50
+ )
51
+
52
+ stargate_v2 = StargateV2Contract(stargate_v2_contract, web3)
53
+
54
+ stargate_fee = stargate_v2.quote_send(send_params)
55
+
56
+ stargate_v2.send(
57
+ account,
58
+ amount.wei + stargate_fee[0],
59
+ send_params,
60
+ stargate_fee,
61
+ account.address
62
+ )
63
+
64
+ def __calculate_bridge_amount(self, account, bridge_amount_interval, from_chain_instance, min_native_balance, web3):
65
+ native_without_min = verify_balance(min_native_balance, from_chain_instance, account, web3)
66
+
67
+ amount = interval_to_native_balance(bridge_amount_interval, account, from_chain_instance['chain'], web3)
68
+ if amount.wei > native_without_min.wei:
69
+ if bridge_amount_interval == 'all_balance':
70
+ amount = native_without_min
71
+ else:
72
+ raise NotEnoughNativeBalance(
73
+ f"The account balance ({native_without_min}) < bridging amount ({amount}).")
74
+ return amount
@@ -0,0 +1,47 @@
1
+ from sybil_engine.module.module import Module
2
+ from sybil_engine.utils.utils import ConfigurationException
3
+ from sybil_engine.utils.validation_utils import validate_amount_interval, validate_chain
4
+
5
+ from web3_wizzard_lib.core.modules.bridge.coredao_bridge_sub import CoreDaoBridgeSubModule
6
+ from web3_wizzard_lib.core.modules.bridge.orbiter_sub import OrbiterSubModule
7
+ from web3_wizzard_lib.core.modules.bridge.scroll_bridge_sub import ScrollBridgeSubModule
8
+ from web3_wizzard_lib.core.modules.bridge.stargate_v2_sub import StargateV2SubModule
9
+
10
+
11
+ class BridgeModule(Module):
12
+ module_name = 'BRIDGE'
13
+ module_config = 'bridge_module'
14
+
15
+ supported_tokens = ['NATIVE', 'USDC', 'USDT', 'WETH']
16
+
17
+ def execute(self, bridge, bridge_amount_interval, from_chain, to_chain, token, account):
18
+ if bridge == 'ORBITER':
19
+ module = OrbiterSubModule()
20
+ elif bridge == 'STARGATE_V2':
21
+ module = StargateV2SubModule()
22
+ elif bridge == 'COREDAO':
23
+ module = CoreDaoBridgeSubModule()
24
+ elif bridge == 'SCROLL':
25
+ module = ScrollBridgeSubModule()
26
+ else:
27
+ raise ConfigurationException(f'Bridge {bridge} is not supported')
28
+
29
+ module.execute(bridge_amount_interval, from_chain, to_chain, token, self.min_native_balance, account)
30
+
31
+ def log(self):
32
+ return "BRIDGE"
33
+
34
+ def parse_params(self, module_params):
35
+ validate_amount_interval(module_params['bridge_amount_interval'])
36
+ validate_chain(module_params['from_chain'])
37
+
38
+ if 'token' not in module_params:
39
+ module_params['token'] = 'NATIVE'
40
+
41
+ if module_params['token'] not in self.supported_tokens:
42
+ raise ConfigurationException(
43
+ f"{module_params['token']} not supported in orbiter. Supported options: {self.supported_tokens}")
44
+
45
+ return module_params['bridge'], module_params['bridge_amount_interval'], module_params['from_chain'], \
46
+ module_params['to_chain'], \
47
+ module_params['token']
@@ -0,0 +1,109 @@
1
+ from typing import Union
2
+
3
+ import requests
4
+ from loguru import logger
5
+ from sybil_engine.data.contracts import get_contracts_for_chain
6
+ from sybil_engine.data.networks import get_chain_instance
7
+ from sybil_engine.domain.balance.balance_utils import get_native_balance, interval_to_eth_balance, from_wei_to_eth
8
+ from sybil_engine.module.module import Module
9
+ from sybil_engine.utils.utils import ConfigurationException
10
+ from sybil_engine.utils.validation_utils import validate_chain, validate_refuel_interval
11
+ from sybil_engine.utils.web3_utils import init_web3
12
+
13
+ from web3_wizzard_lib.core.contract.bungee import bungee_chain_ids, Bungee
14
+
15
+
16
+ class BungeeRefuel(Module):
17
+ module_name = 'BUNGEE'
18
+ module_config = 'bungee_config'
19
+
20
+ def execute(self, refuel_amount_interval, from_chain, to_chain, account):
21
+ from_chain_instance = get_chain_instance(from_chain)
22
+ web3 = init_web3(from_chain_instance, account.proxy)
23
+
24
+ bungee_contract = get_contracts_for_chain(from_chain)['BUNGEE']
25
+ bungee = Bungee(bungee_contract, web3)
26
+
27
+ try:
28
+ limits = self.get_bungee_limits(from_chain)
29
+
30
+ to_chain_limits = [
31
+ chain for chain in limits if chain["chainId"] == bungee_chain_ids[to_chain] and chain["isEnabled"]
32
+ ]
33
+
34
+ if to_chain_limits:
35
+ min_amount = float(from_wei_to_eth(int(to_chain_limits[0]["minAmount"])))
36
+ max_amount = float(from_wei_to_eth(int(to_chain_limits[0]["maxAmount"])))
37
+
38
+ if refuel_amount_interval == 'max':
39
+ refuel_amount_interval = {'from': max_amount * 0.9, 'to': max_amount * 0.98}
40
+
41
+ if refuel_amount_interval == '':
42
+ refuel_amount_interval = {'from': min_amount, 'to': max_amount}
43
+
44
+ if refuel_amount_interval['from'] < min_amount:
45
+ raise ConfigurationException(
46
+ f'Min refuel amount for {from_chain} is {min_amount} < {refuel_amount_interval["from"]}')
47
+
48
+ if refuel_amount_interval['to'] > max_amount:
49
+ raise ConfigurationException(
50
+ f'Max refuel amount for {from_chain} is {max_amount} > {refuel_amount_interval["to"]}')
51
+
52
+ native_without_min = get_native_balance(account, web3, from_chain_instance).minus(
53
+ self.min_native_balance)
54
+
55
+ amount = interval_to_eth_balance(refuel_amount_interval, account, from_chain, web3)
56
+
57
+ if amount.wei > native_without_min.wei:
58
+ amount = native_without_min
59
+
60
+ logger.info(f"Refuel {from_chain.title()} > {to_chain.title()} | {amount}")
61
+
62
+ bungee.refuel(account, to_chain, amount.wei)
63
+ else:
64
+ logger.info("skip")
65
+ except Exception as e:
66
+ logger.error(f"Bungee refuel error | error {e}")
67
+
68
+ def get_bungee_limits(self, from_chain) -> Union[dict, bool]:
69
+ bungee_data = self.get_bungee_data()
70
+
71
+ try:
72
+ if from_chain == 'ZKSYNC':
73
+ limits = [chain_data for chain_data in bungee_data if chain_data["name"] == "zkSync"][0]["limits"]
74
+ elif from_chain == 'ARBITRUM':
75
+ limits = [chain_data for chain_data in bungee_data if chain_data["name"] == "Arbitrum"][0]["limits"]
76
+ elif from_chain == 'OPTIMISM':
77
+ limits = [chain_data for chain_data in bungee_data if chain_data["name"] == "Optimism"][0]["limits"]
78
+ elif from_chain == 'POLYGON':
79
+ limits = [chain_data for chain_data in bungee_data if chain_data["name"] == "Polygon"][0]["limits"]
80
+ elif from_chain == 'AVALANCHE':
81
+ limits = [chain_data for chain_data in bungee_data if chain_data["name"] == "Avalanche"][0]["limits"]
82
+ elif from_chain == 'BSC':
83
+ limits = [chain_data for chain_data in bungee_data if chain_data["name"] == "BSC"][0]["limits"]
84
+ elif from_chain == 'BASE':
85
+ limits = [chain_data for chain_data in bungee_data if chain_data["name"] == "Base"][0]["limits"]
86
+ else:
87
+ raise Exception("Not supported")
88
+
89
+ return limits
90
+ except Exception as e:
91
+ return False
92
+
93
+ def get_bungee_data(self):
94
+ url = "https://refuel.socket.tech/chains"
95
+ response = requests.get(url)
96
+ if response.status_code == 200:
97
+ data = response.json()["result"]
98
+ return data
99
+ return False
100
+
101
+ def log(self):
102
+ return "BUNGEE REFUEL"
103
+
104
+ def parse_params(self, module_params):
105
+ validate_chain(module_params['from_chain'])
106
+ validate_chain(module_params['to_chain'])
107
+ validate_refuel_interval(module_params['refuel_amount_interval'])
108
+
109
+ return module_params['refuel_amount_interval'], module_params['from_chain'], module_params['to_chain']
@@ -0,0 +1,60 @@
1
+ from loguru import logger
2
+ from sybil_engine.contract.send import Send
3
+ from sybil_engine.data.networks import get_chain_instance
4
+ from sybil_engine.domain.balance.balance_utils import interval_to_native_balance, interval_to_erc20_balance
5
+ from sybil_engine.domain.balance.tokens import Erc20Token
6
+ from sybil_engine.module.module import Module
7
+ from sybil_engine.utils.accumulator import add_accumulator_native_balance
8
+ from sybil_engine.utils.retry import retry
9
+ from sybil_engine.utils.validation_utils import validate_chain, validate_amount_interval
10
+ from sybil_engine.utils.web3_utils import init_web3
11
+
12
+
13
+ class SendToCex(Module):
14
+ module_name = 'SEND_TO_CEX'
15
+ module_config = 'send_to_cex_config'
16
+ supported_chains = ['USDC', 'USDT', 'ZK', 'ZRO', 'OBT']
17
+
18
+ def execute(self, chain, send_to_cex_amount_interval, token, account):
19
+ cex_address = account.cex_address
20
+ chain_instance = get_chain_instance(chain)
21
+ web3 = init_web3(chain_instance, account.proxy)
22
+
23
+ if token == 'NATIVE':
24
+ amount = interval_to_native_balance(send_to_cex_amount_interval, account, chain_instance['chain'], web3)
25
+
26
+ if send_to_cex_amount_interval == 'all_balance':
27
+ amount = amount.minus(self.min_native_balance)
28
+ elif token in self.supported_chains:
29
+ amount = interval_to_erc20_balance(send_to_cex_amount_interval, account, token, chain, web3)
30
+ else:
31
+ raise Exception(f"Token {token} not supported. Only NATIVE and USDC/USDT are supported.")
32
+
33
+ if amount.wei == 0 :
34
+ logger.info("Wallet is empty")
35
+ return
36
+
37
+ self.send_funds(account, amount, cex_address, chain, chain_instance, token, web3)
38
+
39
+ add_accumulator_native_balance("Total sent to cex", amount.wei)
40
+
41
+ @retry(max_attempts=5, retry_interval={'from': 60 * 2, 'to': 60 * 3})
42
+ def send_funds(self, account, amount, cex_address, chain, chain_instance, token, web3):
43
+ logger.info(f"Send {amount} to {cex_address} ({chain_instance['chain']})")
44
+ if token == 'NATIVE':
45
+ send = Send(None, web3)
46
+ send.send_to_wallet(account, cex_address, amount)
47
+ elif token in self.supported_chains:
48
+ erc20_token = Erc20Token(chain, token, web3)
49
+ erc20_token.transfer(amount, cex_address, account)
50
+ else:
51
+ raise Exception(f"Token {token} not supported. Only NATIVE and USDC/USDT are supported.")
52
+
53
+ def log(self):
54
+ return "SEND TO CEX"
55
+
56
+ def parse_params(self, module_params):
57
+ validate_chain(module_params['chain'])
58
+ validate_amount_interval(module_params['amount'])
59
+
60
+ return module_params['chain'], module_params['amount'], module_params['token']