web3-wizzard-lib 1.6.12__py3-none-any.whl → 1.6.14__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.14.dist-info}/METADATA +1 -1
- web3_wizzard_lib-1.6.14.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.14.dist-info}/WHEEL +0 -0
- {web3_wizzard_lib-1.6.12.dist-info → web3_wizzard_lib-1.6.14.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
from datetime import datetime
|
2
|
+
|
3
|
+
from sybil_engine.contract.contract import Contract
|
4
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
5
|
+
from sybil_engine.data.networks import get_ids_chain
|
6
|
+
from sybil_engine.data.tokens import get_tokens_for_chain
|
7
|
+
from sybil_engine.utils.file_loader import load_abi
|
8
|
+
|
9
|
+
swap_method_id = 'c04b8d59'
|
10
|
+
|
11
|
+
length_3c = '000000000000000000000000000000000000000000000000000000000000003c'
|
12
|
+
universal_value = '000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0'
|
13
|
+
|
14
|
+
abi = load_abi("resources/abi/maverick_multicall.json")
|
15
|
+
|
16
|
+
|
17
|
+
class MaverickMulticall(Contract):
|
18
|
+
def __init__(self, contract_address, web3):
|
19
|
+
self.weth_token = get_tokens_for_chain(get_ids_chain()[web3.eth.chain_id])['WETH']
|
20
|
+
super().__init__(contract_address, web3, abi)
|
21
|
+
|
22
|
+
@evm_transaction
|
23
|
+
def multicall(self, account, amount_to_swap, amount_out_min_in, token_in_address, pool_address, token_out_address):
|
24
|
+
txn_params = self.build_generic_data(account.address, False)
|
25
|
+
|
26
|
+
if amount_to_swap.token == 'ETH':
|
27
|
+
txn_params['value'] = amount_to_swap.wei # amount in for ETH
|
28
|
+
|
29
|
+
deadline_hex = decimal_to_padded_hexadecimal(int(datetime.now().timestamp() + 60 * 60 * 3), 64)
|
30
|
+
amount_in = decimal_to_padded_hexadecimal(amount_to_swap.wei, 64)
|
31
|
+
amount_out_min = decimal_to_padded_hexadecimal(amount_out_min_in, 64)
|
32
|
+
recipient = pad_hex(account.address, 64) if token_out_address != self.weth_token else pad_hex('', 64)
|
33
|
+
|
34
|
+
eth_to_usdc = '0x' + swap_method_id + universal_value + recipient + deadline_hex + amount_in + amount_out_min + length_3c + pad_hex(
|
35
|
+
token_in_address, 40) + pad_hex(pool_address, 40) + pad_hex(token_out_address, 40) + '00000000'
|
36
|
+
|
37
|
+
if token_out_address == self.weth_token:
|
38
|
+
encoded_action = self.contract.encode_abi("unwrapWETH9", args=(amount_out_min_in, account.address))
|
39
|
+
else:
|
40
|
+
encoded_action = self.contract.encode_abi("refundETH") + pad_hex(account.address, 128)
|
41
|
+
|
42
|
+
return self.contract.functions.multicall([eth_to_usdc, encoded_action]).build_transaction(txn_params)
|
43
|
+
|
44
|
+
|
45
|
+
def decimal_to_padded_hexadecimal(decimal_number, desired_length):
|
46
|
+
hex_value = hex(decimal_number)[2:]
|
47
|
+
|
48
|
+
return hex_value.zfill(desired_length)
|
49
|
+
|
50
|
+
|
51
|
+
def pad_hex(un_padded_hex, desired_length):
|
52
|
+
return un_padded_hex[2:].zfill(desired_length)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from sybil_engine.contract.contract import Contract
|
2
|
+
from sybil_engine.data.networks import get_ids_chain
|
3
|
+
from sybil_engine.data.tokens import get_tokens_for_chain
|
4
|
+
|
5
|
+
abi = 'test'
|
6
|
+
|
7
|
+
|
8
|
+
class MendiFinanceContract(Contract):
|
9
|
+
def __init__(self, contract_address, web3):
|
10
|
+
self.weth_token = get_tokens_for_chain(get_ids_chain()[web3.eth.chain_id])['WETH']
|
11
|
+
super().__init__(contract_address, web3, abi)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from sybil_engine.contract.contract import Contract
|
2
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
3
|
+
from sybil_engine.utils.file_loader import load_abi
|
4
|
+
|
5
|
+
abi = load_abi("resources/abi/mendi_token.json")
|
6
|
+
|
7
|
+
|
8
|
+
class MendiTokenContract(Contract):
|
9
|
+
def __init__(self, contract_address, web3):
|
10
|
+
super().__init__(contract_address, web3, abi)
|
11
|
+
|
12
|
+
@evm_transaction
|
13
|
+
def mint(self, account, amount):
|
14
|
+
txn_params = self.build_generic_data(account.address, False)
|
15
|
+
|
16
|
+
return self.contract.functions.mint(amount).build_transaction(txn_params)
|
17
|
+
|
18
|
+
@evm_transaction
|
19
|
+
def redeem(self, account, amount):
|
20
|
+
txn_params = self.build_generic_data(account.address, False)
|
21
|
+
|
22
|
+
return self.contract.functions.redeemUnderlying(amount).build_transaction(txn_params)
|
23
|
+
|
24
|
+
def balance_of(self, account):
|
25
|
+
return self.contract.functions.balanceOfUnderlying(account.address).call()
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from sybil_engine.contract.contract import Contract
|
2
|
+
from sybil_engine.contract.transaction_executor import evm_transaction, l0_evm_transaction
|
3
|
+
from sybil_engine.utils.file_loader import load_abi
|
4
|
+
from web3 import Web3
|
5
|
+
|
6
|
+
abi = load_abi("resources/abi/merkly.json")
|
7
|
+
|
8
|
+
|
9
|
+
class MerklyMinter(Contract):
|
10
|
+
def __init__(self, contract_address, web3):
|
11
|
+
super().__init__(contract_address, web3, abi)
|
12
|
+
|
13
|
+
@evm_transaction
|
14
|
+
def mint(self, account):
|
15
|
+
txn_params = self.build_generic_data(account.address, False)
|
16
|
+
|
17
|
+
txn_params['value'] = Web3.to_wei(0.0004, "ether")
|
18
|
+
contract_txn = self.contract.functions.mint().build_transaction(txn_params)
|
19
|
+
|
20
|
+
return contract_txn
|
21
|
+
|
22
|
+
@l0_evm_transaction
|
23
|
+
def refuel(self, account, to_chain_id, amount_wei, fee):
|
24
|
+
txn_params = self.build_generic_data(account.address, False)
|
25
|
+
|
26
|
+
hex_amount = self.decimal_to_hex_padded(amount_wei)
|
27
|
+
|
28
|
+
txn_params['value'] = amount_wei + fee
|
29
|
+
contract_txn = self.contract.functions.bridgeGas(
|
30
|
+
to_chain_id,
|
31
|
+
account.address,
|
32
|
+
f'0x00020000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000{hex_amount}{account.address[2:]}'
|
33
|
+
).build_transaction(txn_params)
|
34
|
+
|
35
|
+
return contract_txn
|
36
|
+
|
37
|
+
def estimate_send_fee(self, account, to_chain_id, hex_amount):
|
38
|
+
return self.contract.functions.estimateSendFee(
|
39
|
+
to_chain_id,
|
40
|
+
b'0x', # _zroPaymentAddress
|
41
|
+
f'0x00020000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000{hex_amount}{account.address[2:]}'
|
42
|
+
# _adapterParams
|
43
|
+
).call()[0]
|
44
|
+
|
45
|
+
def decimal_to_hex_padded(self, decimal_number):
|
46
|
+
hex_number = hex(decimal_number)[2:] # Remove the '0x' prefix
|
47
|
+
return hex_number.zfill(32) # Pad with zeros to make the length 32
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from sybil_engine.contract.contract import Contract
|
2
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
3
|
+
from sybil_engine.utils.file_loader import load_abi
|
4
|
+
|
5
|
+
abi = load_abi("resources/abi/micro3.json")
|
6
|
+
|
7
|
+
|
8
|
+
class Micro3Contract(Contract):
|
9
|
+
def __init__(self, contract_address, web3):
|
10
|
+
super().__init__(contract_address, web3, abi)
|
11
|
+
|
12
|
+
@evm_transaction
|
13
|
+
def purchase(self, account, amount):
|
14
|
+
txn_params = self.build_generic_data(account.address, False)
|
15
|
+
|
16
|
+
txn_params['value'] = 80000000000000
|
17
|
+
|
18
|
+
return self.contract.functions.purchase(amount).build_transaction(txn_params)
|
@@ -0,0 +1,93 @@
|
|
1
|
+
from datetime import datetime
|
2
|
+
|
3
|
+
from sybil_engine.contract.contract import Contract
|
4
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
5
|
+
from sybil_engine.data.networks import get_ids_chain
|
6
|
+
from sybil_engine.data.tokens import get_tokens_for_chain
|
7
|
+
from sybil_engine.utils.file_loader import load_abi
|
8
|
+
|
9
|
+
abi = load_abi("resources/abi/mute_router.json")
|
10
|
+
|
11
|
+
|
12
|
+
class MuteRouter(Contract):
|
13
|
+
def __init__(self, contract_address, web3):
|
14
|
+
tokens = get_tokens_for_chain(get_ids_chain()[web3.eth.chain_id])
|
15
|
+
self.weth_address = tokens['WETH']
|
16
|
+
self.usdc_address = tokens['USDC']
|
17
|
+
super().__init__(contract_address, web3, abi)
|
18
|
+
|
19
|
+
@evm_transaction
|
20
|
+
def swap_exact_eth_for_tokens_supporting_fee_on_transfer_tokens(self, account, amount_to_swap, token_in_address,
|
21
|
+
token_out_address, amount_out_min):
|
22
|
+
sender = account.address
|
23
|
+
|
24
|
+
path = [token_in_address, token_out_address]
|
25
|
+
deadline = int(datetime.now().timestamp() + 60 * 60 * 3)
|
26
|
+
stable = [True, False] if token_out_address == self.usdc_address else [False, False]
|
27
|
+
|
28
|
+
txn_params = self.build_generic_data(sender)
|
29
|
+
|
30
|
+
txn_params['value'] = amount_to_swap.wei
|
31
|
+
txn_params['data'] = self.contract.encode_abi('swapExactETHForTokensSupportingFeeOnTransferTokens', args=(
|
32
|
+
amount_out_min,
|
33
|
+
path,
|
34
|
+
sender,
|
35
|
+
deadline,
|
36
|
+
stable
|
37
|
+
)
|
38
|
+
)
|
39
|
+
|
40
|
+
txn_params['gas'] = self.web3.eth.estimate_gas(txn_params)
|
41
|
+
|
42
|
+
return txn_params
|
43
|
+
|
44
|
+
@evm_transaction
|
45
|
+
def swap_exact_tokens_for_eth_supporting_fee_on_transfer_tokens(self, account, amount_to_swap, token_in_address,
|
46
|
+
token_out_address, amount_out_min):
|
47
|
+
sender = account.address
|
48
|
+
|
49
|
+
txn_params = self.build_generic_data(sender, False)
|
50
|
+
|
51
|
+
path = [token_in_address, token_out_address]
|
52
|
+
deadline = int(datetime.now().timestamp() + 60 * 60 * 3)
|
53
|
+
stable = [False, False]
|
54
|
+
|
55
|
+
contract_txn = self.contract.functions.swapExactTokensForETHSupportingFeeOnTransferTokens(
|
56
|
+
amount_to_swap.wei,
|
57
|
+
amount_out_min,
|
58
|
+
path,
|
59
|
+
sender,
|
60
|
+
deadline,
|
61
|
+
stable
|
62
|
+
).build_transaction(txn_params)
|
63
|
+
|
64
|
+
return contract_txn
|
65
|
+
|
66
|
+
@evm_transaction
|
67
|
+
def swap_exact_tokens_for_tokens_supporting_fee_on_transfer_tokens(self, account, amount_to_swap, token_in_address,
|
68
|
+
token_out_address, amount_out_min):
|
69
|
+
sender = account.address
|
70
|
+
|
71
|
+
txn_params = self.build_generic_data(sender, False)
|
72
|
+
|
73
|
+
path = [token_in_address, self.weth_address, token_out_address]
|
74
|
+
deadline = int(datetime.now().timestamp() + 60 * 60 * 3)
|
75
|
+
stable = [True, False, False] if token_in_address == self.usdc_address else [False, True, False]
|
76
|
+
|
77
|
+
contract_txn = self.contract.functions.swapExactTokensForTokensSupportingFeeOnTransferTokens(
|
78
|
+
amount_to_swap.wei,
|
79
|
+
amount_out_min,
|
80
|
+
path,
|
81
|
+
sender,
|
82
|
+
deadline,
|
83
|
+
stable
|
84
|
+
).build_transaction(txn_params)
|
85
|
+
|
86
|
+
return contract_txn
|
87
|
+
|
88
|
+
def get_amount_out(self, amount_to_swap, token_in_address, token_out_address):
|
89
|
+
return self.contract.functions.getAmountOut(
|
90
|
+
amount_to_swap.wei,
|
91
|
+
token_in_address,
|
92
|
+
token_out_address
|
93
|
+
).call()[0]
|
@@ -0,0 +1,31 @@
|
|
1
|
+
from sybil_engine.contract.contract import Contract
|
2
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
3
|
+
from sybil_engine.utils.file_loader import load_abi
|
4
|
+
|
5
|
+
abi = load_abi("resources/abi/new_rage_abi.json")
|
6
|
+
|
7
|
+
|
8
|
+
class NewRageContract(Contract):
|
9
|
+
def __init__(self, contract_address, web3):
|
10
|
+
super().__init__(contract_address, web3, abi)
|
11
|
+
|
12
|
+
@evm_transaction
|
13
|
+
def redeem(self, account, shares):
|
14
|
+
txn_params = self.build_generic_data(account.address, False)
|
15
|
+
|
16
|
+
contract_txn = self.contract.functions.redeem(
|
17
|
+
shares,
|
18
|
+
account.address,
|
19
|
+
account.address,
|
20
|
+
).build_transaction(txn_params)
|
21
|
+
|
22
|
+
return contract_txn
|
23
|
+
|
24
|
+
def balance_of(self, account):
|
25
|
+
return self.contract.functions.balanceOf(account.address).call()
|
26
|
+
|
27
|
+
def convert_to_shares(self, amount):
|
28
|
+
return self.contract.functions.convertToShares(amount).call()
|
29
|
+
|
30
|
+
def max_redeem(self, account):
|
31
|
+
return self.contract.functions.maxRedeem(account.address).call()
|
@@ -0,0 +1,44 @@
|
|
1
|
+
from loguru import logger
|
2
|
+
from sybil_engine.contract.contract import Contract
|
3
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
4
|
+
from sybil_engine.utils.file_loader import load_abi
|
5
|
+
|
6
|
+
abi = load_abi("resources/abi/nidus.json")
|
7
|
+
|
8
|
+
|
9
|
+
class NidumContract(Contract):
|
10
|
+
def __init__(self, contract_address, web3):
|
11
|
+
super().__init__(contract_address, web3, abi)
|
12
|
+
|
13
|
+
@evm_transaction
|
14
|
+
def mint_nft(self, account, claim_data):
|
15
|
+
txn_params = self.build_generic_data(account.address, False)
|
16
|
+
|
17
|
+
token_ids = [9]
|
18
|
+
nft_amounts = [1]
|
19
|
+
nonce = 0
|
20
|
+
|
21
|
+
message = claim_data['message']
|
22
|
+
signature = claim_data['signature']
|
23
|
+
|
24
|
+
return self.contract.functions.mintFromShadowBatch(
|
25
|
+
_tokenID=token_ids,
|
26
|
+
_nftAmountForMint=nft_amounts,
|
27
|
+
_nonce=nonce,
|
28
|
+
_msgForSign=message, # The original hashed message (no changes needed here)
|
29
|
+
_signature=signature # The generated signature
|
30
|
+
).build_transaction(txn_params)
|
31
|
+
|
32
|
+
@evm_transaction
|
33
|
+
def burn(self, account):
|
34
|
+
txn_params = self.build_generic_data(account.address, False)
|
35
|
+
token_id = 9
|
36
|
+
|
37
|
+
balance = self.contract.functions.balanceOf(account.address, token_id).call()
|
38
|
+
if balance == 0:
|
39
|
+
logger.error(f"[{account.app_id}][{account.address}] No nidum nft. Mint first. Skip module")
|
40
|
+
return
|
41
|
+
|
42
|
+
return self.contract.functions.burn(
|
43
|
+
self.contract.address, 9, 1
|
44
|
+
).build_transaction(txn_params)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import random
|
2
|
+
from datetime import datetime
|
3
|
+
|
4
|
+
from sybil_engine.contract.contract import Contract
|
5
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
6
|
+
from sybil_engine.utils.file_loader import load_abi
|
7
|
+
from web3 import Web3
|
8
|
+
|
9
|
+
abi = load_abi("resources/abi/nile_pool.json")
|
10
|
+
|
11
|
+
|
12
|
+
class NileContract(Contract):
|
13
|
+
def __init__(self, contract_address, web3):
|
14
|
+
super().__init__(contract_address, web3, abi)
|
15
|
+
|
16
|
+
@evm_transaction
|
17
|
+
def add_liquidity_eth(self, account, token, max_token, amount_eth):
|
18
|
+
tx_data = self.build_generic_data(account.address, False)
|
19
|
+
|
20
|
+
deadline = int(datetime.now().timestamp()) + random.randint(60, 60 * 60 * 24)
|
21
|
+
tx_data['value'] = amount_eth.wei
|
22
|
+
|
23
|
+
return self.contract.functions.addLiquidityETH(
|
24
|
+
token,
|
25
|
+
False,
|
26
|
+
int(max_token * 0.99),
|
27
|
+
int(max_token * 0.95),
|
28
|
+
int(amount_eth.wei * 0.95),
|
29
|
+
account.address,
|
30
|
+
deadline
|
31
|
+
).build_transaction(tx_data)
|
32
|
+
|
33
|
+
@evm_transaction
|
34
|
+
def remove_liquidity_eth(self, account, token, liquidity, amount_eth, max_token):
|
35
|
+
tx_data = self.build_generic_data(
|
36
|
+
account.address,
|
37
|
+
False
|
38
|
+
)
|
39
|
+
|
40
|
+
deadline = int(datetime.now().timestamp()) + random.randint(60, 60 * 60 * 24)
|
41
|
+
|
42
|
+
return self.contract.functions.removeLiquidityETH(
|
43
|
+
token,
|
44
|
+
False,
|
45
|
+
int(liquidity * 0.99),
|
46
|
+
int(max_token * 0.95),
|
47
|
+
int(amount_eth * 0.95),
|
48
|
+
account.address,
|
49
|
+
deadline
|
50
|
+
).build_transaction(tx_data)
|
51
|
+
|
52
|
+
def quote_remove_liquidity_eth(self, token_in, token_out, liquidity):
|
53
|
+
return self.contract.functions.quoteRemoveLiquidity(token_in, token_out, False, liquidity).call()
|
54
|
+
|
55
|
+
def get_amount_out(self, amount, from_token, to_token):
|
56
|
+
return self.contract.functions.getAmountOut(
|
57
|
+
amount.wei,
|
58
|
+
Web3.to_checksum_address(from_token),
|
59
|
+
Web3.to_checksum_address(to_token)
|
60
|
+
).call()
|
@@ -0,0 +1,40 @@
|
|
1
|
+
from loguru import logger
|
2
|
+
from sybil_engine.contract.contract import Contract
|
3
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
4
|
+
from sybil_engine.utils.file_loader import load_abi
|
5
|
+
from web3 import Web3
|
6
|
+
|
7
|
+
abi = load_abi("resources/abi/nomis_attest.json")
|
8
|
+
|
9
|
+
|
10
|
+
class NomisAttestContract(Contract):
|
11
|
+
def __init__(self, contract_address, web3):
|
12
|
+
super().__init__(contract_address, web3, abi)
|
13
|
+
|
14
|
+
@evm_transaction
|
15
|
+
def attest(self,
|
16
|
+
account,
|
17
|
+
schema,
|
18
|
+
expirationTime,
|
19
|
+
revocable,
|
20
|
+
tokenId,
|
21
|
+
updated,
|
22
|
+
value,
|
23
|
+
chainId,
|
24
|
+
calcModel,
|
25
|
+
validationPayload
|
26
|
+
):
|
27
|
+
txn_params = self.build_generic_data(account.address, False)
|
28
|
+
txn_params['gasPrice'] = int(self.web3.eth.gas_price * 2)
|
29
|
+
return self.contract.functions.attestNomisScoreSimple(
|
30
|
+
schema,
|
31
|
+
expirationTime,
|
32
|
+
revocable,
|
33
|
+
tokenId,
|
34
|
+
updated,
|
35
|
+
value,
|
36
|
+
chainId,
|
37
|
+
calcModel,
|
38
|
+
validationPayload
|
39
|
+
).build_transaction(txn_params)
|
40
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
from loguru import logger
|
2
|
+
from sybil_engine.contract.contract import Contract
|
3
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
4
|
+
from sybil_engine.utils.file_loader import load_abi
|
5
|
+
from web3 import Web3
|
6
|
+
|
7
|
+
abi = load_abi("resources/abi/nomis.json")
|
8
|
+
|
9
|
+
|
10
|
+
class NomisContract(Contract):
|
11
|
+
def __init__(self, contract_address, web3):
|
12
|
+
super().__init__(contract_address, web3, abi)
|
13
|
+
|
14
|
+
@evm_transaction
|
15
|
+
def set_score(self,
|
16
|
+
account,
|
17
|
+
signature,
|
18
|
+
mintedScore,
|
19
|
+
calculationModel,
|
20
|
+
deadline,
|
21
|
+
metadataUrl,
|
22
|
+
chainId,
|
23
|
+
referralCode,
|
24
|
+
referrerCode,
|
25
|
+
onftMetadataUrl
|
26
|
+
):
|
27
|
+
txn_params = self.build_generic_data(account.address, False)
|
28
|
+
txn_params['value'] = Web3.to_wei(0.001, 'ether')
|
29
|
+
return self.contract.functions.setScore(
|
30
|
+
signature,
|
31
|
+
mintedScore,
|
32
|
+
calculationModel,
|
33
|
+
deadline,
|
34
|
+
metadataUrl,
|
35
|
+
chainId,
|
36
|
+
referralCode,
|
37
|
+
referrerCode,
|
38
|
+
onftMetadataUrl
|
39
|
+
).build_transaction(txn_params)
|
40
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
from sybil_engine.contract.contract import Contract
|
2
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
3
|
+
from sybil_engine.utils.file_loader import load_abi
|
4
|
+
|
5
|
+
abi = load_abi("resources/abi/octomos.json")
|
6
|
+
|
7
|
+
|
8
|
+
class OctomosContract(Contract):
|
9
|
+
def __init__(self, contract_address, web3):
|
10
|
+
super().__init__(contract_address, web3, abi)
|
11
|
+
|
12
|
+
@evm_transaction
|
13
|
+
def launchpadBuy(self,
|
14
|
+
account,
|
15
|
+
undef,
|
16
|
+
launchpadId,
|
17
|
+
slotId,
|
18
|
+
quantity,
|
19
|
+
additional,
|
20
|
+
data
|
21
|
+
):
|
22
|
+
txn_params = self.build_generic_data(account.address, False)
|
23
|
+
|
24
|
+
return self.contract.functions.launchpadBuy(
|
25
|
+
undef,
|
26
|
+
launchpadId,
|
27
|
+
slotId,
|
28
|
+
quantity,
|
29
|
+
additional,
|
30
|
+
data
|
31
|
+
).build_transaction(txn_params)
|
@@ -0,0 +1,104 @@
|
|
1
|
+
import requests
|
2
|
+
from sybil_engine.config.app_config import get_network
|
3
|
+
|
4
|
+
from sybil_engine.contract.contract import Contract
|
5
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
6
|
+
from sybil_engine.utils.file_loader import load_abi
|
7
|
+
from sybil_engine.utils.utils import SwapException
|
8
|
+
|
9
|
+
abi = load_abi("resources/abi/lineaswap_router.json")
|
10
|
+
|
11
|
+
referral = {
|
12
|
+
324: 387663447,
|
13
|
+
260: 387663447,
|
14
|
+
8453: 1030612943,
|
15
|
+
18453: 1030612943,
|
16
|
+
59144: 268273819
|
17
|
+
}
|
18
|
+
|
19
|
+
chain_map_id = {
|
20
|
+
'BASE': 8453,
|
21
|
+
'ZKSYNC': 324
|
22
|
+
}
|
23
|
+
|
24
|
+
|
25
|
+
class Odos(Contract):
|
26
|
+
def __init__(self, contract_address, web3):
|
27
|
+
super().__init__(contract_address, web3, abi)
|
28
|
+
|
29
|
+
def quote(self, account, from_token: str, to_token: str, amount: int, slippage: float, chain: str):
|
30
|
+
chain_id = self.get_chain_id(chain)
|
31
|
+
|
32
|
+
url = "https://api.odos.xyz/sor/quote/v2"
|
33
|
+
|
34
|
+
data = {
|
35
|
+
"chainId": chain_id,
|
36
|
+
"inputTokens": [
|
37
|
+
{
|
38
|
+
"tokenAddress": from_token,
|
39
|
+
"amount": f"{amount}"
|
40
|
+
}
|
41
|
+
],
|
42
|
+
"outputTokens": [
|
43
|
+
{
|
44
|
+
"tokenAddress": to_token,
|
45
|
+
"proportion": 1
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"slippageLimitPercent": slippage,
|
49
|
+
"userAddr": account.address,
|
50
|
+
"referralCode": referral[self.web3.eth.chain_id] if True is True else 0,
|
51
|
+
"compact": True
|
52
|
+
}
|
53
|
+
|
54
|
+
response = self.proxy_request(account, data, url)
|
55
|
+
|
56
|
+
if response.status_code == 200:
|
57
|
+
return response.json()
|
58
|
+
else:
|
59
|
+
raise SwapException(f"[{account.app_id}][{account.address}] Bad Odos request")
|
60
|
+
|
61
|
+
def assemble(self, account, path_id):
|
62
|
+
url = "https://api.odos.xyz/sor/assemble"
|
63
|
+
|
64
|
+
data = {
|
65
|
+
"userAddr": account.address,
|
66
|
+
"pathId": path_id,
|
67
|
+
"simulate": False,
|
68
|
+
}
|
69
|
+
|
70
|
+
response = self.proxy_request(account, data, url)
|
71
|
+
|
72
|
+
if response.status_code == 200:
|
73
|
+
return response.json()
|
74
|
+
else:
|
75
|
+
raise SwapException(f"[{account.app_id}][{account.address}] Bad Odos request")
|
76
|
+
|
77
|
+
def proxy_request(self, account, data, url):
|
78
|
+
proxies = {}
|
79
|
+
proxies.update(
|
80
|
+
{"http": account.proxy}
|
81
|
+
)
|
82
|
+
response = requests.post(
|
83
|
+
url=url,
|
84
|
+
headers={"Content-Type": "application/json"},
|
85
|
+
json=data,
|
86
|
+
proxies=proxies
|
87
|
+
)
|
88
|
+
return response
|
89
|
+
|
90
|
+
@evm_transaction
|
91
|
+
def swap(self, account, transaction_data):
|
92
|
+
transaction = transaction_data["transaction"]
|
93
|
+
|
94
|
+
transaction["nonce"] = self.web3.eth.get_transaction_count(transaction['from'])
|
95
|
+
transaction["chainId"] = self.web3.eth.chain_id
|
96
|
+
transaction["value"] = int(transaction["value"])
|
97
|
+
|
98
|
+
return transaction
|
99
|
+
|
100
|
+
def get_chain_id(self, chain):
|
101
|
+
if get_network() == 'MAIN':
|
102
|
+
return self.web3.eth.chain_id
|
103
|
+
else:
|
104
|
+
return chain_map_id[chain]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import time
|
2
|
+
|
3
|
+
from sybil_engine.contract.contract import Contract
|
4
|
+
from sybil_engine.contract.transaction_executor import evm_transaction
|
5
|
+
from sybil_engine.utils.file_loader import load_abi
|
6
|
+
|
7
|
+
abi = load_abi("resources/abi/omnisea.json")
|
8
|
+
|
9
|
+
|
10
|
+
class OmniSea(Contract):
|
11
|
+
def __init__(self, contract_address, web3):
|
12
|
+
super().__init__(contract_address, web3, abi)
|
13
|
+
|
14
|
+
@evm_transaction
|
15
|
+
def create(self, account, title, symbol):
|
16
|
+
txn_params = self.build_generic_data(account.address, False)
|
17
|
+
|
18
|
+
contract_txn = self.contract.functions.create([
|
19
|
+
title,
|
20
|
+
symbol,
|
21
|
+
"",
|
22
|
+
"",
|
23
|
+
0,
|
24
|
+
True,
|
25
|
+
0,
|
26
|
+
int(time.time()) + 1000000]
|
27
|
+
).build_transaction(txn_params)
|
28
|
+
|
29
|
+
return contract_txn
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from sybil_engine.contract.contract import Contract
|
2
|
+
from sybil_engine.contract.transaction_executor import evm_starknet_transaction
|
3
|
+
from sybil_engine.utils.file_loader import load_abi
|
4
|
+
|
5
|
+
abi = load_abi("resources/abi/orbiter_starknet.json")
|
6
|
+
|
7
|
+
|
8
|
+
class OrbiterStarknet(Contract):
|
9
|
+
def __init__(self, contract_address, web3):
|
10
|
+
super().__init__(contract_address, web3, abi)
|
11
|
+
|
12
|
+
@evm_starknet_transaction
|
13
|
+
def bridge(self, account, amount):
|
14
|
+
txn_params = self.build_generic_data(account.address, False)
|
15
|
+
|
16
|
+
txn_params['value'] = amount.wei
|
17
|
+
|
18
|
+
if account.starknet_address[:3] == '0x0':
|
19
|
+
starknet_wallet = f'030{account.starknet_address[3:]}'
|
20
|
+
else:
|
21
|
+
starknet_wallet = f'030{account.starknet_address[2:]}'
|
22
|
+
|
23
|
+
starknet_wallet = bytes.fromhex(starknet_wallet)
|
24
|
+
|
25
|
+
contract_txn = self.contract.functions.transfer(
|
26
|
+
'0x80C67432656d59144cEFf962E8fAF8926599bCF8',
|
27
|
+
starknet_wallet
|
28
|
+
).build_transaction(txn_params)
|
29
|
+
|
30
|
+
return contract_txn
|