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.
- web3_wizzard_lib/core/__init__.py +1 -0
- web3_wizzard_lib/core/contract/__init__.py +0 -0
- web3_wizzard_lib/core/contract/aavecontract.py +36 -0
- web3_wizzard_lib/core/contract/alienswap_contract.py +21 -0
- web3_wizzard_lib/core/contract/arena_games_contract.py +16 -0
- web3_wizzard_lib/core/contract/basiliskcontract.py +58 -0
- web3_wizzard_lib/core/contract/bilinear_contract.py +22 -0
- web3_wizzard_lib/core/contract/bungee.py +33 -0
- web3_wizzard_lib/core/contract/coredao_contract.py +34 -0
- web3_wizzard_lib/core/contract/coredao_from_contract.py +40 -0
- web3_wizzard_lib/core/contract/dmail_send_mail.py +18 -0
- web3_wizzard_lib/core/contract/empty_nft.py +18 -0
- web3_wizzard_lib/core/contract/era_name.py +23 -0
- web3_wizzard_lib/core/contract/eralendcontract.py +34 -0
- web3_wizzard_lib/core/contract/eth_scroll_bridge_contract.py +25 -0
- web3_wizzard_lib/core/contract/frog_war_contract.py +48 -0
- web3_wizzard_lib/core/contract/gmx_reward_router.py +22 -0
- web3_wizzard_lib/core/contract/horizondex_quoter.py +14 -0
- web3_wizzard_lib/core/contract/horizondex_router.py +91 -0
- web3_wizzard_lib/core/contract/imagine_contract.py +18 -0
- web3_wizzard_lib/core/contract/izumi.py +63 -0
- web3_wizzard_lib/core/contract/kreatorland_contract.py +21 -0
- web3_wizzard_lib/core/contract/l0_claim.py +254 -0
- web3_wizzard_lib/core/contract/l2_telegraph.py +21 -0
- web3_wizzard_lib/core/contract/layerbank_price.py +18 -0
- web3_wizzard_lib/core/contract/layerbank_token.py +29 -0
- web3_wizzard_lib/core/contract/layerbankcontract.py +59 -0
- web3_wizzard_lib/core/contract/linea_day_2_contract.py +19 -0
- web3_wizzard_lib/core/contract/linea_day_3_contract.py +55 -0
- web3_wizzard_lib/core/contract/linea_ens_names_contract.py +55 -0
- web3_wizzard_lib/core/contract/lineaswaprouter.py +52 -0
- web3_wizzard_lib/core/contract/maverick_multicall.py +52 -0
- web3_wizzard_lib/core/contract/mendi_finance_contract.py +11 -0
- web3_wizzard_lib/core/contract/mendi_token.py +25 -0
- web3_wizzard_lib/core/contract/merkly_minter.py +47 -0
- web3_wizzard_lib/core/contract/micro3_contract.py +18 -0
- web3_wizzard_lib/core/contract/mute_router.py +93 -0
- web3_wizzard_lib/core/contract/new_rage_contract.py +31 -0
- web3_wizzard_lib/core/contract/nidum_contract.py +44 -0
- web3_wizzard_lib/core/contract/nile_contract.py +60 -0
- web3_wizzard_lib/core/contract/nomis_attest_contract.py +40 -0
- web3_wizzard_lib/core/contract/nomis_contract.py +40 -0
- web3_wizzard_lib/core/contract/octomos.py +31 -0
- web3_wizzard_lib/core/contract/odos.py +104 -0
- web3_wizzard_lib/core/contract/omnisea.py +29 -0
- web3_wizzard_lib/core/contract/orbiter_starknet.py +30 -0
- web3_wizzard_lib/core/contract/pancake_pool.py +19 -0
- web3_wizzard_lib/core/contract/pancake_quoter.py +20 -0
- web3_wizzard_lib/core/contract/pancake_router.py +72 -0
- web3_wizzard_lib/core/contract/rage_claim.py +24 -0
- web3_wizzard_lib/core/contract/reactor_fusion_contract.py +78 -0
- web3_wizzard_lib/core/contract/readon_contract.py +19 -0
- web3_wizzard_lib/core/contract/rubyscore_contract.py +31 -0
- web3_wizzard_lib/core/contract/satoshi_universe_contract.py +29 -0
- web3_wizzard_lib/core/contract/scroll_bridge_contract.py +24 -0
- web3_wizzard_lib/core/contract/scroll_canvas_mint_contract.py +26 -0
- web3_wizzard_lib/core/contract/scroll_oracle.py +11 -0
- web3_wizzard_lib/core/contract/snap_contract.py +16 -0
- web3_wizzard_lib/core/contract/social_scan_contract.py +20 -0
- web3_wizzard_lib/core/contract/stargate_farming.py +37 -0
- web3_wizzard_lib/core/contract/stargate_router.py +84 -0
- web3_wizzard_lib/core/contract/stargate_router_eth.py +41 -0
- web3_wizzard_lib/core/contract/stargate_token_pool.py +45 -0
- web3_wizzard_lib/core/contract/stargate_v2_contract.py +36 -0
- web3_wizzard_lib/core/contract/syncswap_classic_pool.py +15 -0
- web3_wizzard_lib/core/contract/syncswap_classic_pool_factory.py +15 -0
- web3_wizzard_lib/core/contract/syncswap_pool.py +25 -0
- web3_wizzard_lib/core/contract/syncswap_router.py +123 -0
- web3_wizzard_lib/core/contract/tavaera_id.py +18 -0
- web3_wizzard_lib/core/contract/tavaera_mint.py +17 -0
- web3_wizzard_lib/core/contract/townstory_bonus_contract.py +19 -0
- web3_wizzard_lib/core/contract/townstory_contract.py +21 -0
- web3_wizzard_lib/core/contract/velocore_lens.py +44 -0
- web3_wizzard_lib/core/contract/velocore_pool.py +198 -0
- web3_wizzard_lib/core/contract/velocore_router.py +80 -0
- web3_wizzard_lib/core/contract/woofi_swap.py +29 -0
- web3_wizzard_lib/core/contract/xy_finance_contract.py +87 -0
- web3_wizzard_lib/core/contract/yoddlo_contract.py +19 -0
- web3_wizzard_lib/core/contract/yuliverse_contract.py +36 -0
- web3_wizzard_lib/core/contract/zebra_contract.py +68 -0
- web3_wizzard_lib/core/contract/zerolend_contract.py +34 -0
- web3_wizzard_lib/core/contract/zerolend_liq_contract.py +20 -0
- web3_wizzard_lib/core/contract/zkdx_contract.py +40 -0
- web3_wizzard_lib/core/contract/zkdx_data.py +14 -0
- web3_wizzard_lib/core/contract/zks.py +24 -0
- web3_wizzard_lib/core/modules/__init__.py +0 -0
- web3_wizzard_lib/core/modules/ads_import_proxy.py +52 -0
- web3_wizzard_lib/core/modules/airdrop_printer.py +81 -0
- web3_wizzard_lib/core/modules/bank/__init__.py +0 -0
- web3_wizzard_lib/core/modules/bank/aave.py +25 -0
- web3_wizzard_lib/core/modules/bank/bank.py +15 -0
- web3_wizzard_lib/core/modules/bank/basilisk.py +25 -0
- web3_wizzard_lib/core/modules/bank/eralend.py +25 -0
- web3_wizzard_lib/core/modules/bank/layerbank.py +116 -0
- web3_wizzard_lib/core/modules/bank/mendi_finance.py +57 -0
- web3_wizzard_lib/core/modules/bank/reactorfusion.py +25 -0
- web3_wizzard_lib/core/modules/bank/zerolend.py +36 -0
- web3_wizzard_lib/core/modules/bank_module.py +99 -0
- web3_wizzard_lib/core/modules/bridge/__init__.py +0 -0
- web3_wizzard_lib/core/modules/bridge/bridge.py +8 -0
- web3_wizzard_lib/core/modules/bridge/coredao_bridge_sub.py +47 -0
- web3_wizzard_lib/core/modules/bridge/orbiter_sub.py +112 -0
- web3_wizzard_lib/core/modules/bridge/scroll_bridge_sub.py +42 -0
- web3_wizzard_lib/core/modules/bridge/stargate_v2_sub.py +74 -0
- web3_wizzard_lib/core/modules/bridge_module.py +47 -0
- web3_wizzard_lib/core/modules/bungee.py +109 -0
- web3_wizzard_lib/core/modules/cex_sender.py +60 -0
- web3_wizzard_lib/core/modules/cex_subaccount_transfer.py +34 -0
- web3_wizzard_lib/core/modules/cex_withdraw.py +91 -0
- web3_wizzard_lib/core/modules/claimer.py +45 -0
- web3_wizzard_lib/core/modules/claims/__init__.py +0 -0
- web3_wizzard_lib/core/modules/claims/layerzero_claimer.py +64 -0
- web3_wizzard_lib/core/modules/claims/rabby_claimer.py +81 -0
- web3_wizzard_lib/core/modules/concrete_swap.py +108 -0
- web3_wizzard_lib/core/modules/coredao_bridge.py +32 -0
- web3_wizzard_lib/core/modules/coredao_bridge_auto.py +39 -0
- web3_wizzard_lib/core/modules/debank_checker.py +78 -0
- web3_wizzard_lib/core/modules/dmail.py +54 -0
- web3_wizzard_lib/core/modules/erc20_balance.py +42 -0
- web3_wizzard_lib/core/modules/gmx_reward.py +25 -0
- web3_wizzard_lib/core/modules/intract/__init__.py +0 -0
- web3_wizzard_lib/core/modules/intract/intract_api.py +212 -0
- web3_wizzard_lib/core/modules/intract/utils.py +81 -0
- web3_wizzard_lib/core/modules/intract_claim.py +101 -0
- web3_wizzard_lib/core/modules/layer_2_20.py +65 -0
- web3_wizzard_lib/core/modules/lending_module.py +134 -0
- web3_wizzard_lib/core/modules/linea_appeal.py +98 -0
- web3_wizzard_lib/core/modules/linea_poh_lxp.py +65 -0
- web3_wizzard_lib/core/modules/liquidity/__init__.py +0 -0
- web3_wizzard_lib/core/modules/liquidity/nile_pool.py +64 -0
- web3_wizzard_lib/core/modules/liquidity/pool.py +16 -0
- web3_wizzard_lib/core/modules/liquidity/syncswap_pool.py +61 -0
- web3_wizzard_lib/core/modules/liquidity/velocore_pool.py +55 -0
- web3_wizzard_lib/core/modules/liquidity/zerolend_liquidity.py +26 -0
- web3_wizzard_lib/core/modules/liquidity_pool.py +60 -0
- web3_wizzard_lib/core/modules/merkly_refuel.py +87 -0
- web3_wizzard_lib/core/modules/new_rage_withdraw.py +41 -0
- web3_wizzard_lib/core/modules/nft/__init__.py +0 -0
- web3_wizzard_lib/core/modules/nft/abbys_world.py +22 -0
- web3_wizzard_lib/core/modules/nft/acg_worlds.py +25 -0
- web3_wizzard_lib/core/modules/nft/alienswap_linea.py +22 -0
- web3_wizzard_lib/core/modules/nft/arena_games.py +22 -0
- web3_wizzard_lib/core/modules/nft/asmatch.py +22 -0
- web3_wizzard_lib/core/modules/nft/battlemon.py +25 -0
- web3_wizzard_lib/core/modules/nft/bilinear.py +22 -0
- web3_wizzard_lib/core/modules/nft/bitavatar.py +25 -0
- web3_wizzard_lib/core/modules/nft/culture_satoshi_universe.py +24 -0
- web3_wizzard_lib/core/modules/nft/efrogs.py +26 -0
- web3_wizzard_lib/core/modules/nft/empty_nft.py +22 -0
- web3_wizzard_lib/core/modules/nft/era_domain.py +42 -0
- web3_wizzard_lib/core/modules/nft/frog_war.py +22 -0
- web3_wizzard_lib/core/modules/nft/frog_war_bonus.py +22 -0
- web3_wizzard_lib/core/modules/nft/gamerboom.py +25 -0
- web3_wizzard_lib/core/modules/nft/gamerboom_bonus.py +26 -0
- web3_wizzard_lib/core/modules/nft/imagine.py +32 -0
- web3_wizzard_lib/core/modules/nft/kreatorland_module.py +35 -0
- web3_wizzard_lib/core/modules/nft/l2_telegraph_module.py +22 -0
- web3_wizzard_lib/core/modules/nft/layer3_meta.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_2_2_linus.py +24 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_2_3_yooldo.py +24 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_2_4_frogwar.py +24 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_2_5_acg.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_2_6_ascend_the_end.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_3_1_ascend_the_end.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_3_2_sending_me.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_3_3_townstory.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_3_4_daniele.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_3_5_demmortal.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_3_6_foxy.py +25 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_4_1_coop_records.py +60 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_4_2_borja_moskv.py +65 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_4_2_borja_moskv_approve.py +27 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_4_3_fruit.py +66 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_4_4_fruit_crux.py +67 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_4_5_forbidden_fruit.py +67 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_4_6_laurent.py +67 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_day2.py +20 -0
- web3_wizzard_lib/core/modules/nft/linea_culture_day3.py +20 -0
- web3_wizzard_lib/core/modules/nft/linea_ens_names.py +107 -0
- web3_wizzard_lib/core/modules/nft/lucky_cat.py +25 -0
- web3_wizzard_lib/core/modules/nft/merkly_minter_module.py +22 -0
- web3_wizzard_lib/core/modules/nft/micro3.py +23 -0
- web3_wizzard_lib/core/modules/nft/mint_2048.py +28 -0
- web3_wizzard_lib/core/modules/nft/nft_submodule.py +16 -0
- web3_wizzard_lib/core/modules/nft/nidum.py +87 -0
- web3_wizzard_lib/core/modules/nft/nidum_bonus.py +23 -0
- web3_wizzard_lib/core/modules/nft/nomis.py +64 -0
- web3_wizzard_lib/core/modules/nft/nomis_attest.py +66 -0
- web3_wizzard_lib/core/modules/nft/nouns.py +27 -0
- web3_wizzard_lib/core/modules/nft/octomos.py +32 -0
- web3_wizzard_lib/core/modules/nft/omnisea.py +33 -0
- web3_wizzard_lib/core/modules/nft/omnizone.py +25 -0
- web3_wizzard_lib/core/modules/nft/orbiter_claim.py +87 -0
- web3_wizzard_lib/core/modules/nft/readon.py +30 -0
- web3_wizzard_lib/core/modules/nft/rubyscore.py +45 -0
- web3_wizzard_lib/core/modules/nft/sarubol.py +22 -0
- web3_wizzard_lib/core/modules/nft/satoshi_universe.py +22 -0
- web3_wizzard_lib/core/modules/nft/scroll_canvas_attest_year_badge.py +35 -0
- web3_wizzard_lib/core/modules/nft/scroll_canvas_mint.py +51 -0
- web3_wizzard_lib/core/modules/nft/sign.py +32 -0
- web3_wizzard_lib/core/modules/nft/snap.py +25 -0
- web3_wizzard_lib/core/modules/nft/snap_bonus.py +31 -0
- web3_wizzard_lib/core/modules/nft/social_scan.py +22 -0
- web3_wizzard_lib/core/modules/nft/tavaera.py +30 -0
- web3_wizzard_lib/core/modules/nft/townstory.py +75 -0
- web3_wizzard_lib/core/modules/nft/townstory_bonus.py +45 -0
- web3_wizzard_lib/core/modules/nft/trusta_reputation.py +48 -0
- web3_wizzard_lib/core/modules/nft/trustaa_poh.py +49 -0
- web3_wizzard_lib/core/modules/nft/uber_poh.py +24 -0
- web3_wizzard_lib/core/modules/nft/wizards_of_linea.py +26 -0
- web3_wizzard_lib/core/modules/nft/yoddlo.py +22 -0
- web3_wizzard_lib/core/modules/nft/yuliverse.py +22 -0
- web3_wizzard_lib/core/modules/nft/zace.py +25 -0
- web3_wizzard_lib/core/modules/nft/zks_domain.py +41 -0
- web3_wizzard_lib/core/modules/nft_minter.py +107 -0
- web3_wizzard_lib/core/modules/orbiter.py +39 -0
- web3_wizzard_lib/core/modules/orbiter_checker.py +26 -0
- web3_wizzard_lib/core/modules/rage.py +54 -0
- web3_wizzard_lib/core/modules/scroll_bridge.py +45 -0
- web3_wizzard_lib/core/modules/sell_all.py +51 -0
- web3_wizzard_lib/core/modules/sleep_module.py +25 -0
- web3_wizzard_lib/core/modules/smart_contract_deployment.py +37 -0
- web3_wizzard_lib/core/modules/stargate/__init__.py +0 -0
- web3_wizzard_lib/core/modules/stargate/auto_bridge.py +91 -0
- web3_wizzard_lib/core/modules/stargate/bridge.py +38 -0
- web3_wizzard_lib/core/modules/stargate/bridge_eth.py +59 -0
- web3_wizzard_lib/core/modules/stargate/bridge_tokens.py +48 -0
- web3_wizzard_lib/core/modules/stargate/classic_bridge.py +34 -0
- web3_wizzard_lib/core/modules/stargate/farming.py +163 -0
- web3_wizzard_lib/core/modules/stargate/l0_data.py +10 -0
- web3_wizzard_lib/core/modules/stargate/pool.py +74 -0
- web3_wizzard_lib/core/modules/stargate/stargate_balance_utils.py +25 -0
- web3_wizzard_lib/core/modules/stargate/stargate_gas_checker.py +68 -0
- web3_wizzard_lib/core/modules/swap/__init__.py +1 -0
- web3_wizzard_lib/core/modules/swap/horizondex.py +38 -0
- web3_wizzard_lib/core/modules/swap/izumi.py +41 -0
- web3_wizzard_lib/core/modules/swap/lineaswap.py +34 -0
- web3_wizzard_lib/core/modules/swap/maverick.py +66 -0
- web3_wizzard_lib/core/modules/swap/mute.py +39 -0
- web3_wizzard_lib/core/modules/swap/odos.py +58 -0
- web3_wizzard_lib/core/modules/swap/one_inch.py +58 -0
- web3_wizzard_lib/core/modules/swap/pancake.py +41 -0
- web3_wizzard_lib/core/modules/swap/swap_list.py +11 -0
- web3_wizzard_lib/core/modules/swap/syncswap.py +62 -0
- web3_wizzard_lib/core/modules/swap/velocore.py +40 -0
- web3_wizzard_lib/core/modules/swap/woofi.py +38 -0
- web3_wizzard_lib/core/modules/swap/xy_finance.py +43 -0
- web3_wizzard_lib/core/modules/swap/zebra.py +32 -0
- web3_wizzard_lib/core/modules/warm_up.py +98 -0
- web3_wizzard_lib/core/modules/wrapping.py +74 -0
- web3_wizzard_lib/core/modules/zkdx.py +63 -0
- web3_wizzard_lib/core/utils/__init__.py +0 -0
- web3_wizzard_lib/core/utils/ai_utils.py +45 -0
- web3_wizzard_lib/core/utils/benchmark_utils.py +12 -0
- web3_wizzard_lib/core/utils/module_memory.py +28 -0
- web3_wizzard_lib/core/utils/statistic_utils.py +150 -0
- web3_wizzard_lib/core/utils/sub_module.py +8 -0
- web3_wizzard_lib/data/__init__.py +0 -0
- web3_wizzard_lib/data/config_default.py +52 -0
- web3_wizzard_lib/data/module_config_default.py +209 -0
- web3_wizzard_lib/utils/__init__.py +0 -0
- web3_wizzard_lib/utils/debank_utils.py +19 -0
- {web3_wizzard_lib-1.6.12.dist-info → web3_wizzard_lib-1.6.15.dist-info}/METADATA +2 -2
- web3_wizzard_lib-1.6.15.dist-info/RECORD +369 -0
- web3_wizzard_lib-1.6.12.dist-info/RECORD +0 -107
- {web3_wizzard_lib-1.6.12.dist-info → web3_wizzard_lib-1.6.15.dist-info}/WHEEL +0 -0
- {web3_wizzard_lib-1.6.12.dist-info → web3_wizzard_lib-1.6.15.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
import random
|
2
|
+
|
3
|
+
from loguru import logger
|
4
|
+
from sybil_engine.data.contracts import get_contracts_for_chain
|
5
|
+
from sybil_engine.data.networks import get_chain_instance, set_rpc_for_chain
|
6
|
+
from sybil_engine.module.module import RepeatableModule, Order
|
7
|
+
from sybil_engine.utils.package_import_utils import import_all_modules_in_directory, get_all_subclasses
|
8
|
+
from sybil_engine.utils.scan_utils import find_interacted_contracts
|
9
|
+
from sybil_engine.utils.utils import ConfigurationException, randomized_sleeping, RetryException, print_exception_chain
|
10
|
+
from sybil_engine.utils.validation_utils import validate_interval
|
11
|
+
|
12
|
+
from web3_wizzard_lib.core.modules.nft.nft_submodule import NftSubmodule
|
13
|
+
from web3_wizzard_lib.core.utils.sub_module import SubModule
|
14
|
+
|
15
|
+
|
16
|
+
class NFTMinter(RepeatableModule):
|
17
|
+
module_name = 'NFT_MINTER'
|
18
|
+
module_config = 'nft_minter'
|
19
|
+
random_order = Order.RANDOM
|
20
|
+
repeat_conf = 'nft_amount_interval'
|
21
|
+
sleep_after_var = True
|
22
|
+
retries = 100
|
23
|
+
|
24
|
+
@RepeatableModule.repeatable_log
|
25
|
+
def execute(self, nft_module_names, nft_amount_interval, unique_nft, skip_delay, account):
|
26
|
+
self.sleep_after_var = True
|
27
|
+
self.storage.setdefault("minted_nfts", [])
|
28
|
+
minted_nfts = self.storage.get("minted_nfts")
|
29
|
+
|
30
|
+
nft_modules_without_minted = [item for item in set(nft_module_names) if item not in minted_nfts]
|
31
|
+
nfts = [nft for nft in self.get_nfts() if nft and nft.module_name in nft_modules_without_minted]
|
32
|
+
|
33
|
+
if nft_amount_interval['to'] > len(nft_module_names):
|
34
|
+
raise ConfigurationException(
|
35
|
+
f"Interval {nft_amount_interval} to > amount of NFT nfts allowed {len(nft_module_names)}")
|
36
|
+
|
37
|
+
inited_module = random.choice(nfts)()
|
38
|
+
|
39
|
+
if unique_nft and not hasattr(inited_module, "allow_reuse_address"):
|
40
|
+
chain = 'LINEA'
|
41
|
+
interactions = find_interacted_contracts(
|
42
|
+
account.address,
|
43
|
+
get_chain_instance(chain)['api_scan'],
|
44
|
+
get_chain_instance(chain)['api_scan_key']
|
45
|
+
)
|
46
|
+
|
47
|
+
nft_contract_address = self.get_nft_address(chain, inited_module)
|
48
|
+
|
49
|
+
if nft_contract_address in interactions:
|
50
|
+
logger.info(f"{inited_module.log()} already minted for {account.address}")
|
51
|
+
self.sleep_after_var = False
|
52
|
+
randomized_sleeping(skip_delay)
|
53
|
+
return
|
54
|
+
|
55
|
+
logger.info(f"Mint {inited_module.log()}")
|
56
|
+
try:
|
57
|
+
inited_module.execute(account)
|
58
|
+
except SkipRetryException as e:
|
59
|
+
self.sleep_after_var = False
|
60
|
+
logger.info(e)
|
61
|
+
return
|
62
|
+
minted_nfts.append(inited_module.module_name)
|
63
|
+
self.storage.put("minted_nfts", minted_nfts)
|
64
|
+
|
65
|
+
def get_nfts(self):
|
66
|
+
import_all_modules_in_directory("utils.modules.nft")
|
67
|
+
return get_all_subclasses(SubModule) + get_all_subclasses(NftSubmodule)
|
68
|
+
|
69
|
+
def get_nft_address(self, chain, inited_module):
|
70
|
+
if inited_module.module_name in get_contracts_for_chain(chain):
|
71
|
+
return get_contracts_for_chain(chain)[inited_module.module_name]
|
72
|
+
else:
|
73
|
+
return inited_module.nft_address
|
74
|
+
|
75
|
+
def log(self):
|
76
|
+
return "NFT MINTER"
|
77
|
+
|
78
|
+
def parse_params(self, module_params):
|
79
|
+
validate_interval(module_params['nft_amount_interval'])
|
80
|
+
|
81
|
+
if 'skip_delay' not in module_params:
|
82
|
+
module_params['skip_delay'] = {'from': 10, 'to': 30}
|
83
|
+
|
84
|
+
if 'unique_nft' not in module_params:
|
85
|
+
module_params['unique_nft'] = True
|
86
|
+
|
87
|
+
return module_params['nft_modules'], module_params['nft_amount_interval'], module_params['unique_nft'], \
|
88
|
+
module_params['skip_delay']
|
89
|
+
|
90
|
+
retry_counter = 0
|
91
|
+
|
92
|
+
def handle(self, e):
|
93
|
+
print_exception_chain(e)
|
94
|
+
|
95
|
+
if self.retry_counter < self.retries:
|
96
|
+
self.retry_counter = self.retry_counter + 1
|
97
|
+
logger.info(f"{self.retry_counter} retries from {self.retries}")
|
98
|
+
set_rpc_for_chain('LINEA')
|
99
|
+
randomized_sleeping({'from': 1, 'to': 60})
|
100
|
+
raise RetryException(e)
|
101
|
+
|
102
|
+
def sleep_after(self):
|
103
|
+
return self.sleep_after_var
|
104
|
+
|
105
|
+
|
106
|
+
class SkipRetryException(Exception):
|
107
|
+
pass
|
@@ -0,0 +1,39 @@
|
|
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.orbiter_sub import OrbiterSubModule
|
6
|
+
|
7
|
+
|
8
|
+
class OrbiterModule(Module):
|
9
|
+
module_name = 'ORBITER'
|
10
|
+
module_config = 'orbiter_config'
|
11
|
+
|
12
|
+
supported_tokens = ['NATIVE', 'USDC', 'USDT', 'WETH']
|
13
|
+
|
14
|
+
def execute(self, bridge_amount_interval, from_chain, to_chain, token, account):
|
15
|
+
OrbiterSubModule().execute(
|
16
|
+
bridge_amount_interval,
|
17
|
+
from_chain,
|
18
|
+
to_chain,
|
19
|
+
token,
|
20
|
+
self.min_native_balance,
|
21
|
+
account
|
22
|
+
)
|
23
|
+
|
24
|
+
def log(self):
|
25
|
+
return "ORBITER BRIDGE"
|
26
|
+
|
27
|
+
def parse_params(self, module_params):
|
28
|
+
validate_amount_interval(module_params['bridge_amount_interval'])
|
29
|
+
validate_chain(module_params['from_chain'])
|
30
|
+
|
31
|
+
if 'token' not in module_params:
|
32
|
+
module_params['token'] = 'NATIVE'
|
33
|
+
|
34
|
+
if module_params['token'] not in self.supported_tokens:
|
35
|
+
raise ConfigurationException(
|
36
|
+
f"{module_params['token']} not supported in orbiter. Supported options: {self.supported_tokens}")
|
37
|
+
|
38
|
+
return module_params['bridge_amount_interval'], module_params['from_chain'], module_params['to_chain'], \
|
39
|
+
module_params['token']
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import requests
|
2
|
+
from loguru import logger
|
3
|
+
from sybil_engine.module.module import Module
|
4
|
+
|
5
|
+
|
6
|
+
class OrbiterChecker(Module):
|
7
|
+
module_name = 'ORBITER_CHECKER'
|
8
|
+
module_config = None
|
9
|
+
|
10
|
+
total_points = 0
|
11
|
+
|
12
|
+
def execute(self, account):
|
13
|
+
url = f'https://api.orbiter.finance/points_platform/rank/address/{account.address.lower()}'
|
14
|
+
|
15
|
+
response = requests.get(url)
|
16
|
+
|
17
|
+
points = int(response.json()['result']['point'])
|
18
|
+
|
19
|
+
if points > 0:
|
20
|
+
self.total_points = self.total_points + points
|
21
|
+
|
22
|
+
logger.info(f"Points {points}")
|
23
|
+
logger.info(f"Total points {self.total_points}")
|
24
|
+
|
25
|
+
def log(self):
|
26
|
+
return "ORBITER CHECKER"
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import requests
|
2
|
+
from loguru import logger
|
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
|
6
|
+
from sybil_engine.module.module import Module
|
7
|
+
from sybil_engine.utils.accumulator import add_accumulator_balance
|
8
|
+
from sybil_engine.utils.utils import AccountException
|
9
|
+
from sybil_engine.utils.web3_utils import init_web3
|
10
|
+
from web3 import Web3
|
11
|
+
|
12
|
+
from web3_wizzard_lib.core.contract.rage_claim import RageClaimer
|
13
|
+
|
14
|
+
|
15
|
+
class Rage(Module):
|
16
|
+
module_name = 'RAGE_WITHDRAW'
|
17
|
+
module_config = None
|
18
|
+
|
19
|
+
def execute(self, account, chain='ARBITRUM'):
|
20
|
+
chain_instance = get_chain_instance(chain)
|
21
|
+
web3 = init_web3(chain_instance, account.proxy)
|
22
|
+
|
23
|
+
contract_address = get_contracts_for_chain(chain_instance['chain'])['RAGE_CLAIM']
|
24
|
+
rage = RageClaimer(contract_address, web3)
|
25
|
+
|
26
|
+
amount, index, merkle_proof = self.get_data(account)
|
27
|
+
usdc_amount = int(amount, 16)
|
28
|
+
|
29
|
+
usdc = Erc20Balance(usdc_amount, chain, 'USDC')
|
30
|
+
|
31
|
+
logger.info(f"Withdraw {usdc.log_line()}")
|
32
|
+
|
33
|
+
bytes32_array = [Web3.to_bytes(hexstr=hex_string[2:]) for hex_string in merkle_proof]
|
34
|
+
|
35
|
+
rage.claim(account, usdc_amount, index, bytes32_array)
|
36
|
+
add_accumulator_balance("Total rage withdraw", usdc_amount)
|
37
|
+
|
38
|
+
def get_data(self, account):
|
39
|
+
# Make the GET request
|
40
|
+
url = f"https://www.app.rage.trade/api/merkel-proof?address={account.address}"
|
41
|
+
|
42
|
+
response = requests.get(url)
|
43
|
+
|
44
|
+
# Check if the request was successful (status code 200)
|
45
|
+
if response.status_code == 200:
|
46
|
+
# Parse the JSON response
|
47
|
+
claim_data = response.json()["claim"]
|
48
|
+
|
49
|
+
return claim_data["amount"], claim_data["index"], claim_data["proof"]
|
50
|
+
else:
|
51
|
+
raise AccountException(f"HTTP request failed with status code {response.status_code}")
|
52
|
+
|
53
|
+
def log(self):
|
54
|
+
return "RAGE CLAIMER"
|
@@ -0,0 +1,45 @@
|
|
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.scroll_bridge_sub import ScrollBridgeSubModule
|
6
|
+
|
7
|
+
|
8
|
+
class ScrollBridgeModule(Module):
|
9
|
+
module_name = 'SCROLL_BRIDGE'
|
10
|
+
module_config = 'scroll_bridge'
|
11
|
+
|
12
|
+
supported_tokens = ['NATIVE']
|
13
|
+
supported_chains = ['ETH_MAINNET', 'SCROLL']
|
14
|
+
|
15
|
+
def execute(self, bridge_amount_interval, from_chain, to_chain, token, account):
|
16
|
+
ScrollBridgeSubModule().execute(
|
17
|
+
bridge_amount_interval,
|
18
|
+
from_chain,
|
19
|
+
to_chain,
|
20
|
+
token,
|
21
|
+
self.min_native_balance,
|
22
|
+
account
|
23
|
+
)
|
24
|
+
|
25
|
+
def log(self):
|
26
|
+
return "SCROLL BRIDGE"
|
27
|
+
|
28
|
+
def parse_params(self, module_params):
|
29
|
+
validate_amount_interval(module_params['bridge_amount_interval'])
|
30
|
+
validate_chain(module_params['from_chain'])
|
31
|
+
|
32
|
+
if 'token' not in module_params:
|
33
|
+
module_params['token'] = 'NATIVE'
|
34
|
+
|
35
|
+
if module_params['token'] not in self.supported_tokens:
|
36
|
+
raise ConfigurationException(
|
37
|
+
f"{module_params['token']} not supported in scroll bridge. Supported options: {self.supported_tokens}")
|
38
|
+
|
39
|
+
if module_params['to_chain'] not in self.supported_chains or module_params[
|
40
|
+
'to_chain'] not in self.supported_chains:
|
41
|
+
raise ConfigurationException(
|
42
|
+
f"{module_params['chain']} not supported in scroll bridge. Supported options: {self.supported_chains}")
|
43
|
+
|
44
|
+
return module_params['bridge_amount_interval'], module_params['from_chain'], module_params['to_chain'], \
|
45
|
+
module_params['token']
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import random
|
2
|
+
|
3
|
+
from loguru import logger
|
4
|
+
from sybil_engine.data.networks import get_chain_instance
|
5
|
+
from sybil_engine.data.pairs import Pairs
|
6
|
+
from sybil_engine.domain.balance.tokens import Erc20Token
|
7
|
+
from sybil_engine.module.module import Module
|
8
|
+
from sybil_engine.utils.utils import randomized_sleeping
|
9
|
+
from sybil_engine.utils.validation_utils import validate_interval, validate_token
|
10
|
+
from sybil_engine.utils.web3_utils import init_web3
|
11
|
+
|
12
|
+
from web3_wizzard_lib.core.modules.swap.swap_list import swap_facade
|
13
|
+
|
14
|
+
|
15
|
+
class SellAll(Module):
|
16
|
+
module_name = 'SELL_ALL'
|
17
|
+
module_config = 'sell_all_config'
|
18
|
+
allowed_chains = ['ZKSYNC', 'LINEA', 'BASE', 'SCROLL', 'ARBITRUM']
|
19
|
+
|
20
|
+
def execute(self, chain, sleep_interval, receive_token, account):
|
21
|
+
chain_instance = get_chain_instance(chain)
|
22
|
+
web3 = init_web3(chain_instance, account.proxy)
|
23
|
+
|
24
|
+
pairs = Pairs(swap_facade)
|
25
|
+
|
26
|
+
for pair, swaps in pairs.get_all_pair_swaps(chain, pairs.get_pair_names(chain, receive_token), receive_token):
|
27
|
+
erc20_token = Erc20Token(chain, pair['tokens'][1], web3)
|
28
|
+
|
29
|
+
amount_to_sell = erc20_token.balance(account)
|
30
|
+
|
31
|
+
random_app = random.choice(swaps)
|
32
|
+
|
33
|
+
logger.info(f"Sell all on {random_app}")
|
34
|
+
|
35
|
+
if amount_to_sell.wei > 100:
|
36
|
+
swap_facade.swap(account, amount_to_sell, chain_instance, pair, random_app, amount_to_sell.token,
|
37
|
+
pair['tokens'][0], web3)
|
38
|
+
randomized_sleeping(sleep_interval)
|
39
|
+
|
40
|
+
def log(self):
|
41
|
+
return "SELL ALL TOKENS"
|
42
|
+
|
43
|
+
def parse_params(self, module_params):
|
44
|
+
self.validate_supported_chain(module_params['chain'])
|
45
|
+
validate_interval(module_params['sleep_interval'])
|
46
|
+
validate_token(module_params['receive_token'])
|
47
|
+
|
48
|
+
return module_params['chain'], module_params['sleep_interval'], module_params['receive_token']
|
49
|
+
|
50
|
+
def sleep_after(self):
|
51
|
+
return False
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
from sybil_engine.module.module import Module
|
4
|
+
from sybil_engine.utils.utils import randomized_sleeping
|
5
|
+
from sybil_engine.utils.validation_utils import validate_amount_interval
|
6
|
+
|
7
|
+
|
8
|
+
class SleepModule(Module):
|
9
|
+
module_name = 'SLEEP_MODULE'
|
10
|
+
module_config = 'sleep_module_config'
|
11
|
+
|
12
|
+
def execute(self, sleep_interval, account):
|
13
|
+
logging.info("Additional sleeping module")
|
14
|
+
randomized_sleeping(sleep_interval)
|
15
|
+
|
16
|
+
def log(self):
|
17
|
+
return "SLEEP MODULE"
|
18
|
+
|
19
|
+
def sleep_after(self):
|
20
|
+
return False
|
21
|
+
|
22
|
+
def parse_params(self, module_params):
|
23
|
+
validate_amount_interval(module_params['sleep_interval'])
|
24
|
+
|
25
|
+
return [module_params['sleep_interval']]
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import random
|
2
|
+
|
3
|
+
from sybil_engine.contract.deploy_contract import DeployContract
|
4
|
+
from sybil_engine.data.networks import get_chain_instance
|
5
|
+
from sybil_engine.module.module import Module
|
6
|
+
from sybil_engine.utils.web3_utils import init_web3
|
7
|
+
|
8
|
+
erc_20_decoded = (
|
9
|
+
"0x60806040523480156200001157600080fd5b5060405162000f3f38038062000f3f833981016040819052620000349162000349565b338282600362000045838262000442565b50600462000054828262000442565b5050506001600160a01b0381166200008757604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200009281620000c1565b50620000b933620000a66012600a62000623565b620000b390600a6200063b565b62000113565b50506200066b565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166200013f5760405163ec442f0560e01b8152600060048201526024016200007e565b6200014d6000838362000151565b5050565b6001600160a01b0383166200018057806002600082825462000174919062000655565b90915550620001f49050565b6001600160a01b03831660009081526020819052604090205481811015620001d55760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016200007e565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216620002125760028054829003905562000231565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200027791815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002ac57600080fd5b81516001600160401b0380821115620002c957620002c962000284565b604051601f8301601f19908116603f01168101908282118183101715620002f457620002f462000284565b816040528381526020925086838588010111156200031157600080fd5b600091505b8382101562000335578582018301518183018401529082019062000316565b600093810190920192909252949350505050565b600080604083850312156200035d57600080fd5b82516001600160401b03808211156200037557600080fd5b62000383868387016200029a565b935060208501519150808211156200039a57600080fd5b50620003a9858286016200029a565b9150509250929050565b600181811c90821680620003c857607f821691505b602082108103620003e957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200043d57600081815260208120601f850160051c81016020861015620004185750805b601f850160051c820191505b81811015620004395782815560010162000424565b5050505b505050565b81516001600160401b038111156200045e576200045e62000284565b62000476816200046f8454620003b3565b84620003ef565b602080601f831160018114620004ae5760008415620004955750858301515b600019600386901b1c1916600185901b17855562000439565b600085815260208120601f198616915b82811015620004df57888601518255948401946001909101908401620004be565b5085821015620004fe5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620005655781600019048211156200054957620005496200050e565b808516156200055757918102915b93841c939080029062000529565b509250929050565b6000826200057e575060016200061d565b816200058d575060006200061d565b8160018114620005a65760028114620005b157620005d1565b60019150506200061d565b60ff841115620005c557620005c56200050e565b50506001821b6200061d565b5060208310610133831016604e8410600b8410161715620005f6575081810a6200061d565b62000602838362000524565b80600019048211156200061957620006196200050e565b0290505b92915050565b60006200063460ff8416836200056d565b9392505050565b80820281158282048414176200061d576200061d6200050e565b808201808211156200061d576200061d6200050e565b6108c4806200067b6000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b41146101aa578063a9059cbb146101b2578063dd62ed3e146101c5578063f2fde38b146101fe57600080fd5b806370a082311461015e578063715018a6146101875780638da5cb5b1461018f57600080fd5b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a57806340c10f1914610149575b600080fd5b6100dc610211565b6040516100e9919061070e565b60405180910390f35b610105610100366004610778565b6102a3565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046107a2565b6102bd565b604051601281526020016100e9565b61015c610157366004610778565b6102e1565b005b61011961016c3660046107de565b6001600160a01b031660009081526020819052604090205490565b61015c6102f7565b6005546040516001600160a01b0390911681526020016100e9565b6100dc61030b565b6101056101c0366004610778565b61031a565b6101196101d3366004610800565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61015c61020c3660046107de565b610328565b60606003805461022090610833565b80601f016020809104026020016040519081016040528092919081815260200182805461024c90610833565b80156102995780601f1061026e57610100808354040283529160200191610299565b820191906000526020600020905b81548152906001019060200180831161027c57829003601f168201915b5050505050905090565b6000336102b181858561036b565b60019150505b92915050565b6000336102cb85828561037d565b6102d68585856103fb565b506001949350505050565b6102e961045a565b6102f38282610487565b5050565b6102ff61045a565b61030960006104bd565b565b60606004805461022090610833565b6000336102b18185856103fb565b61033061045a565b6001600160a01b03811661035f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610368816104bd565b50565b610378838383600161050f565b505050565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146103f557818110156103e657604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610356565b6103f58484848403600061050f565b50505050565b6001600160a01b03831661042557604051634b637e8f60e11b815260006004820152602401610356565b6001600160a01b03821661044f5760405163ec442f0560e01b815260006004820152602401610356565b6103788383836105e4565b6005546001600160a01b031633146103095760405163118cdaa760e01b8152336004820152602401610356565b6001600160a01b0382166104b15760405163ec442f0560e01b815260006004820152602401610356565b6102f3600083836105e4565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0384166105395760405163e602df0560e01b815260006004820152602401610356565b6001600160a01b03831661056357604051634a1406b160e11b815260006004820152602401610356565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156103f557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105d691815260200190565b60405180910390a350505050565b6001600160a01b03831661060f578060026000828254610604919061086d565b909155506106819050565b6001600160a01b038316600090815260208190526040902054818110156106625760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610356565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661069d576002805482900390556106bc565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161070191815260200190565b60405180910390a3505050565b600060208083528351808285015260005b8181101561073b5785810183015185820160400152820161071f565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461077357600080fd5b919050565b6000806040838503121561078b57600080fd5b6107948361075c565b946020939093013593505050565b6000806000606084860312156107b757600080fd5b6107c08461075c565b92506107ce6020850161075c565b9150604084013590509250925092565b6000602082840312156107f057600080fd5b6107f98261075c565b9392505050565b6000806040838503121561081357600080fd5b61081c8361075c565b915061082a6020840161075c565b90509250929050565b600181811c9082168061084757607f821691505b60208210810361086757634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156102b757634e487b7160e01b600052601160045260246000fdfea26469706673582212204d7841638dc9ced6391696a2cdfdecc60dadba5609654aee754332e2c039e7e564736f6c6343000814003300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000"
|
10
|
+
"8746573746261736500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000087465737462617365000000000000000000000000000000000000000000000000")
|
11
|
+
|
12
|
+
|
13
|
+
class SmartContractDeployment(Module):
|
14
|
+
module_name = 'SMART_CONTRACT_DEPLOYMENT'
|
15
|
+
module_config = 'smart_contract_deployment'
|
16
|
+
|
17
|
+
def execute(self, chain, account):
|
18
|
+
chain_instance = get_chain_instance(chain)
|
19
|
+
web3 = init_web3(chain_instance, account.proxy)
|
20
|
+
|
21
|
+
random_string = self.generate_random_string()
|
22
|
+
|
23
|
+
erc_20_decoded = (
|
24
|
+
f"0x60806040523480156200001157600080fd5b5060405162000f3f38038062000f3f833981016040819052620000349162000349565b338282600362000045838262000442565b50600462000054828262000442565b5050506001600160a01b0381166200008757604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200009281620000c1565b50620000b933620000a66012600a62000623565b620000b390600a6200063b565b62000113565b50506200066b565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166200013f5760405163ec442f0560e01b8152600060048201526024016200007e565b6200014d6000838362000151565b5050565b6001600160a01b0383166200018057806002600082825462000174919062000655565b90915550620001f49050565b6001600160a01b03831660009081526020819052604090205481811015620001d55760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016200007e565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216620002125760028054829003905562000231565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200027791815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002ac57600080fd5b81516001600160401b0380821115620002c957620002c962000284565b604051601f8301601f19908116603f01168101908282118183101715620002f457620002f462000284565b816040528381526020925086838588010111156200031157600080fd5b600091505b8382101562000335578582018301518183018401529082019062000316565b600093810190920192909252949350505050565b600080604083850312156200035d57600080fd5b82516001600160401b03808211156200037557600080fd5b62000383868387016200029a565b935060208501519150808211156200039a57600080fd5b50620003a9858286016200029a565b9150509250929050565b600181811c90821680620003c857607f821691505b602082108103620003e957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200043d57600081815260208120601f850160051c81016020861015620004185750805b601f850160051c820191505b81811015620004395782815560010162000424565b5050505b505050565b81516001600160401b038111156200045e576200045e62000284565b62000476816200046f8454620003b3565b84620003ef565b602080601f831160018114620004ae5760008415620004955750858301515b600019600386901b1c1916600185901b17855562000439565b600085815260208120601f198616915b82811015620004df57888601518255948401946001909101908401620004be565b5085821015620004fe5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620005655781600019048211156200054957620005496200050e565b808516156200055757918102915b93841c939080029062000529565b509250929050565b6000826200057e575060016200061d565b816200058d575060006200061d565b8160018114620005a65760028114620005b157620005d1565b60019150506200061d565b60ff841115620005c557620005c56200050e565b50506001821b6200061d565b5060208310610133831016604e8410600b8410161715620005f6575081810a6200061d565b62000602838362000524565b80600019048211156200061957620006196200050e565b0290505b92915050565b60006200063460ff8416836200056d565b9392505050565b80820281158282048414176200061d576200061d6200050e565b808201808211156200061d576200061d6200050e565b6108c4806200067b6000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b41146101aa578063a9059cbb146101b2578063dd62ed3e146101c5578063f2fde38b146101fe57600080fd5b806370a082311461015e578063715018a6146101875780638da5cb5b1461018f57600080fd5b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a57806340c10f1914610149575b600080fd5b6100dc610211565b6040516100e9919061070e565b60405180910390f35b610105610100366004610778565b6102a3565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046107a2565b6102bd565b604051601281526020016100e9565b61015c610157366004610778565b6102e1565b005b61011961016c3660046107de565b6001600160a01b031660009081526020819052604090205490565b61015c6102f7565b6005546040516001600160a01b0390911681526020016100e9565b6100dc61030b565b6101056101c0366004610778565b61031a565b6101196101d3366004610800565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61015c61020c3660046107de565b610328565b60606003805461022090610833565b80601f016020809104026020016040519081016040528092919081815260200182805461024c90610833565b80156102995780601f1061026e57610100808354040283529160200191610299565b820191906000526020600020905b81548152906001019060200180831161027c57829003601f168201915b5050505050905090565b6000336102b181858561036b565b60019150505b92915050565b6000336102cb85828561037d565b6102d68585856103fb565b506001949350505050565b6102e961045a565b6102f38282610487565b5050565b6102ff61045a565b61030960006104bd565b565b60606004805461022090610833565b6000336102b18185856103fb565b61033061045a565b6001600160a01b03811661035f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610368816104bd565b50565b610378838383600161050f565b505050565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146103f557818110156103e657604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610356565b6103f58484848403600061050f565b50505050565b6001600160a01b03831661042557604051634b637e8f60e11b815260006004820152602401610356565b6001600160a01b03821661044f5760405163ec442f0560e01b815260006004820152602401610356565b6103788383836105e4565b6005546001600160a01b031633146103095760405163118cdaa760e01b8152336004820152602401610356565b6001600160a01b0382166104b15760405163ec442f0560e01b815260006004820152602401610356565b6102f3600083836105e4565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0384166105395760405163e602df0560e01b815260006004820152602401610356565b6001600160a01b03831661056357604051634a1406b160e11b815260006004820152602401610356565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156103f557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105d691815260200190565b60405180910390a350505050565b6001600160a01b03831661060f578060026000828254610604919061086d565b909155506106819050565b6001600160a01b038316600090815260208190526040902054818110156106625760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610356565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661069d576002805482900390556106bc565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161070191815260200190565b60405180910390a3505050565b600060208083528351808285015260005b8181101561073b5785810183015185820160400152820161071f565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461077357600080fd5b919050565b6000806040838503121561078b57600080fd5b6107948361075c565b946020939093013593505050565b6000806000606084860312156107b757600080fd5b6107c08461075c565b92506107ce6020850161075c565b9150604084013590509250925092565b6000602082840312156107f057600080fd5b6107f98261075c565b9392505050565b6000806040838503121561081357600080fd5b61081c8361075c565b915061082a6020840161075c565b90509250929050565b600181811c9082168061084757607f821691505b60208210810361086757634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156102b757634e487b7160e01b600052601160045260246000fdfea26469706673582212204d7841638dc9ced6391696a2cdfdecc60dadba5609654aee754332e2c039e7e564736f6c6343000814003300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000"
|
25
|
+
f"{random_string}000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{random_string}000000000000000000000000000000000000000000000000")
|
26
|
+
|
27
|
+
DeployContract(None, web3).deploy(account, erc_20_decoded)
|
28
|
+
|
29
|
+
def generate_random_string(self, length=18):
|
30
|
+
random_hex = ''.join(random.choice('0123456789abcdef') for _ in range(length))
|
31
|
+
return random_hex
|
32
|
+
|
33
|
+
def log(self):
|
34
|
+
return "Smart Contract Deployment"
|
35
|
+
|
36
|
+
def parse_params(self, module_params):
|
37
|
+
return [module_params['chain']]
|
File without changes
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import random
|
2
|
+
|
3
|
+
from loguru import logger
|
4
|
+
from sybil_engine.domain.balance.balance_utils import find_chain_with_max_usdc, find_chain_with_max_native
|
5
|
+
from sybil_engine.module.module import Module
|
6
|
+
from sybil_engine.utils.utils import randomized_sleeping
|
7
|
+
from sybil_engine.utils.web3_utils import print_account_data, get_all_account_data
|
8
|
+
|
9
|
+
from web3_wizzard_lib.core.modules.stargate.bridge import StargateBridge
|
10
|
+
|
11
|
+
|
12
|
+
class StargateAutoBridge(Module):
|
13
|
+
module_name = 'STARGATE_AUTO_BRIDGE'
|
14
|
+
module_config = 'stargate_auto_bridge_config'
|
15
|
+
|
16
|
+
def execute(self, bridge_amount_interval, token, original_chain_sequence, sleep_interval, retry_interval,
|
17
|
+
end_network, only_end_network_bridge, account):
|
18
|
+
chain_sequence = original_chain_sequence.copy()
|
19
|
+
|
20
|
+
logger.info(f"=============== Bridging for {account.address} ===============")
|
21
|
+
|
22
|
+
account_data = get_all_account_data(account, chain_sequence)
|
23
|
+
print_account_data(account_data)
|
24
|
+
|
25
|
+
if token == 'USDC':
|
26
|
+
max_usdc_chain, usdc, native_balance, web3 = find_chain_with_max_usdc(account_data)
|
27
|
+
else:
|
28
|
+
max_usdc_chain, usdc, native_balance, web3 = find_chain_with_max_native(account_data)
|
29
|
+
|
30
|
+
logger.info(f"Chain with biggest {token} balance is {max_usdc_chain}")
|
31
|
+
|
32
|
+
if only_end_network_bridge:
|
33
|
+
if end_network == '':
|
34
|
+
raise Exception("Env network should be declared on ONLY_END_NETWORK_BRIDGE=True")
|
35
|
+
shuffled_chain_sequence = [max_usdc_chain] + [end_network]
|
36
|
+
else:
|
37
|
+
shuffled_chain_sequence = self.shuffle_chain_sequence(chain_sequence, max_usdc_chain, end_network)
|
38
|
+
|
39
|
+
chain_sequence_readable = 'Result chain sequence: ' + ' -> '.join(shuffled_chain_sequence)
|
40
|
+
logger.info(chain_sequence_readable)
|
41
|
+
self.process_bridge(bridge_amount_interval, token, account, retry_interval, shuffled_chain_sequence,
|
42
|
+
sleep_interval)
|
43
|
+
|
44
|
+
def process_bridge(self, bridge_amount_interval, bridge_token, account, retry_interval, shuffled_chain_sequence,
|
45
|
+
sleep_interval):
|
46
|
+
for chain_number, _ in enumerate(shuffled_chain_sequence[:-1]):
|
47
|
+
from_chain = shuffled_chain_sequence[chain_number]
|
48
|
+
to_chain = shuffled_chain_sequence[chain_number + 1]
|
49
|
+
|
50
|
+
StargateBridge(retry_interval).bridge(
|
51
|
+
self.min_native_balance,
|
52
|
+
account,
|
53
|
+
bridge_amount_interval,
|
54
|
+
bridge_token,
|
55
|
+
from_chain,
|
56
|
+
to_chain
|
57
|
+
)
|
58
|
+
randomized_sleeping(sleep_interval)
|
59
|
+
|
60
|
+
def shuffle_chain_sequence(self, chain_sequence, max_usdc_chain, end_network):
|
61
|
+
chain_sequence.remove(max_usdc_chain)
|
62
|
+
|
63
|
+
while True:
|
64
|
+
random.shuffle(chain_sequence)
|
65
|
+
|
66
|
+
# If reshuffle doesn't result in the prohibited sequence, break out of the loop
|
67
|
+
if not any((chain_sequence[i] == 'FANTOM' and chain_sequence[i + 1] == 'BASE') or
|
68
|
+
(chain_sequence[i] == 'BASE' and chain_sequence[i + 1] == 'FANTOM') or
|
69
|
+
(max_usdc_chain == 'FANTOM' and chain_sequence[0] == 'BASE') or
|
70
|
+
(max_usdc_chain == 'BASE' and chain_sequence[0] == 'FANTOM')
|
71
|
+
for i in range(len(chain_sequence) - 1)):
|
72
|
+
break
|
73
|
+
|
74
|
+
if end_network and chain_sequence[-1] != end_network:
|
75
|
+
chain_sequence.append(end_network)
|
76
|
+
|
77
|
+
return [max_usdc_chain] + chain_sequence
|
78
|
+
|
79
|
+
def log(self):
|
80
|
+
return "STARGATE AUTO"
|
81
|
+
|
82
|
+
def parse_params(self, module_params):
|
83
|
+
return (
|
84
|
+
module_params['bridge_amount_interval'],
|
85
|
+
module_params['bridge_token'],
|
86
|
+
module_params['original_chain_sequence'],
|
87
|
+
module_params['sleep_interval'],
|
88
|
+
module_params['retry_interval'],
|
89
|
+
module_params['end_network'],
|
90
|
+
module_params['only_end_network_bridge']
|
91
|
+
)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
from loguru import logger
|
2
|
+
from sybil_engine.data.networks import get_chain_instance
|
3
|
+
from sybil_engine.domain.balance.balance_utils import verify_balance
|
4
|
+
from sybil_engine.utils.retry import retry_self
|
5
|
+
from sybil_engine.utils.utils import AccountException
|
6
|
+
from sybil_engine.utils.web3_utils import init_web3
|
7
|
+
|
8
|
+
from web3_wizzard_lib.core.modules.stargate.bridge_eth import bridge_eth
|
9
|
+
from web3_wizzard_lib.core.modules.stargate.bridge_tokens import bridge_usdc
|
10
|
+
|
11
|
+
MAX_ATTEMPTS = 5
|
12
|
+
|
13
|
+
|
14
|
+
class StargateBridge:
|
15
|
+
def __init__(self, retry_interval):
|
16
|
+
self.retry_interval = retry_interval
|
17
|
+
|
18
|
+
def bridge(self, min_native_balance, account, bridge_amount_interval, token, from_chain, to_chain):
|
19
|
+
from_chain_config = get_chain_instance(from_chain)
|
20
|
+
to_chain_config = get_chain_instance(to_chain)
|
21
|
+
web3 = init_web3(from_chain_config, account.proxy)
|
22
|
+
|
23
|
+
logger.info(f"======= Bridging {token} {from_chain} ==> {to_chain} ::: {account.address} =======")
|
24
|
+
|
25
|
+
self._bridge(account, bridge_amount_interval, from_chain_config, min_native_balance, to_chain_config, token,
|
26
|
+
web3)
|
27
|
+
|
28
|
+
@retry_self(max_attempts=MAX_ATTEMPTS, expected_exception=Exception, throw_exception=AccountException)
|
29
|
+
def _bridge(self, account, bridge_amount_interval, from_chain_config, min_native_balance, to_chain_config, token,
|
30
|
+
web3):
|
31
|
+
native_without_min = verify_balance(min_native_balance, from_chain_config, account, web3)
|
32
|
+
|
33
|
+
if token == 'ETH':
|
34
|
+
bridge_eth(native_without_min, account, bridge_amount_interval, from_chain_config, to_chain_config, web3)
|
35
|
+
elif token == 'USDC':
|
36
|
+
bridge_usdc(native_without_min, account, bridge_amount_interval, from_chain_config, to_chain_config, web3)
|
37
|
+
else:
|
38
|
+
raise ValueError(f"Unsupported bridge token: {token}, only ETH and USDC are supported")
|
@@ -0,0 +1,59 @@
|
|
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)
|
@@ -0,0 +1,48 @@
|
|
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)
|