Exemplo n.º 1
0
    def __init__(self):
        super().__init__()

        compound_contracts = [
            self.dummy_w3.eth.contract(abi=ctoken_abi)
            #                      self.dummy_w3.eth.contract(abi=comptroller_abi)]
        ]

        exchanges = [
            get_uniswap_exchange_contract(self.dummy_w3),
            get_kyber_network_proxy_contract(self.dummy_w3),
            self.dummy_w3.eth.contract(abi=gnosis_protocol_abi)
        ]
        sight_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (conditional_token_abi, market_maker_abi,
                        market_maker_factory_abi)
        ]
        erc_contracts = [
            get_erc721_contract(self.dummy_w3),
            get_erc20_contract(self.dummy_w3)
        ]

        self.multisend_contracts = [get_multi_send_contract(self.dummy_w3)]

        # Order is important. If signature is the same (e.g. renaming of `baseGas`) last elements in the list
        # will take preference
        self.supported_contracts = (compound_contracts + exchanges +
                                    sight_contracts + erc_contracts +
                                    self.multisend_contracts +
                                    self.supported_contracts)
Exemplo n.º 2
0
    def __init__(self):
        super().__init__()

        compound_contracts = [
            self.dummy_w3.eth.contract(abi=ctoken_abi),
            self.dummy_w3.eth.contract(abi=comptroller_abi),
        ]

        aave_abis = [aave_a_token, aave_lending_pool, aave_lending_pool_addresses_provider, aave_lending_pool_core]
        aave_contracts = [self.dummy_w3.eth.contract(abi=abi) for abi in aave_abis]
        idle_abis = [idle_token_v3]
        idle_contracts = [self.dummy_w3.eth.contract(abi=abi) for abi in idle_abis]
        request_abis = [request_erc20_proxy, request_ethereum_proxy]
        request_contracts = [self.dummy_w3.eth.contract(abi=abi) for abi in request_abis]
        sablier_abis = [sablier_ctoken_manager, sablier_payroll, sablier_abi]
        sablier_contracts = [self.dummy_w3.eth.contract(abi=abi) for abi in sablier_abis]

        exchanges = [get_uniswap_exchange_contract(self.dummy_w3),
                     get_kyber_network_proxy_contract(self.dummy_w3),
                     self.dummy_w3.eth.contract(abi=gnosis_protocol_abi)]
        sight_contracts = [self.dummy_w3.eth.contract(abi=abi) for abi in (conditional_token_abi,
                                                                           market_maker_abi,
                                                                           market_maker_factory_abi)]
        erc_contracts = [get_erc721_contract(self.dummy_w3),
                         get_erc20_contract(self.dummy_w3)]

        self.multisend_contracts = [get_multi_send_contract(self.dummy_w3)]

        # Order is important. If signature is the same (e.g. renaming of `baseGas`) last elements in the list
        # will take preference
        self.supported_contracts = (aave_contracts + idle_contracts + request_contracts + sablier_contracts
                                    + compound_contracts + exchanges + sight_contracts + erc_contracts
                                    + self.multisend_contracts + self.supported_contracts)
    def __init__(self):
        #TODO  Refactor this using inheritance
        self.dummy_w3 = Web3()
        exchanges = [
            get_uniswap_exchange_contract(self.dummy_w3),
            self.dummy_w3.eth.contract(abi=gnosis_protocol_abi)
        ]
        sight_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (conditional_token_abi, market_maker_abi,
                        market_maker_factory_abi)
        ]
        erc_contracts = [
            get_erc721_contract(self.dummy_w3),
            get_erc20_contract(self.dummy_w3)
        ]
        safe_contracts = [
            get_safe_V0_0_1_contract(self.dummy_w3),
            get_safe_V1_0_0_contract(self.dummy_w3),
            get_safe_contract(self.dummy_w3)
        ]

        # Order is important. If signature is the same (e.g. renaming of `baseGas`) last elements in the list
        # will take preference
        self.supported_contracts = exchanges + sight_contracts + erc_contracts + safe_contracts

        # Web3 generates possible selectors every time. We cache that and use a dict to do a fast check
        # Store selectors with abi
        self.supported_fn_selectors: Dict[bytes, ContractFunction] = {}
        for supported_contract in self.supported_contracts:
            self.supported_fn_selectors.update(
                self._generate_selectors_with_abis_from_contract(
                    supported_contract))
    def get_supported_abis(self) -> List[ABI]:
        supported_abis = super().get_supported_abis()

        aave_contracts = [
            aave_a_token, aave_lending_pool,
            aave_lending_pool_addresses_provider, aave_lending_pool_core
        ]
        initializable_admin_upgradeability_proxy_contracts = [
            initializable_admin_upgradeability_proxy_abi
        ]
        balancer_contracts = [balancer_bactions, balancer_exchange_proxy]
        chainlink_contracts = [chainlink_token_abi]
        compound_contracts = [ctoken_abi, comptroller_abi]
        idle_contracts = [idle_token_v3]
        maker_dao_contracts = maker_dao_abis
        open_zeppelin_contracts = [
            open_zeppelin_admin_upgradeability_proxy, open_zeppelin_proxy_admin
        ]
        request_contracts = [
            request_erc20_proxy, request_erc20_swap_to_pay,
            request_ethereum_proxy
        ]
        sablier_contracts = [
            sablier_ctoken_manager, sablier_payroll, sablier_abi
        ]

        snapshot_contracts = [snapshot_delegate_registry_abi]

        exchanges = [
            get_uniswap_exchange_contract(self.dummy_w3).abi,
            get_kyber_network_proxy_contract(self.dummy_w3).abi
        ]

        sight_contracts = [
            conditional_token_abi, market_maker_abi, market_maker_factory_abi
        ]
        gnosis_protocol = [
            gnosis_protocol_abi, fleet_factory_deterministic_abi,
            fleet_factory_abi
        ]

        gnosis_safe = [gnosis_safe_allowance_module_abi]
        erc_contracts = [
            get_erc721_contract(self.dummy_w3).abi,
            get_erc20_contract(self.dummy_w3).abi
        ]

        timelock_contracts = [timelock_abi]

        # Order is important. If signature is the same (e.g. renaming of `baseGas`) last elements in the list
        # will take preference
        return (timelock_contracts +
                initializable_admin_upgradeability_proxy_contracts +
                aave_contracts + balancer_contracts + chainlink_contracts +
                idle_contracts + maker_dao_contracts + request_contracts +
                sablier_contracts + snapshot_contracts +
                open_zeppelin_contracts + compound_contracts + exchanges +
                sight_contracts + gnosis_protocol + gnosis_safe +
                erc_contracts + self._get_multisend_abis() + supported_abis)
Exemplo n.º 5
0
 def send_erc721(self, to: str, token_address: str, token_id: int,
                 **kwargs) -> bool:
     transaction = get_erc721_contract(
         self.ethereum_client.w3,
         token_address).functions.transferFrom(self.address, to,
                                               token_id).buildTransaction({
                                                   'from':
                                                   self.address,
                                                   'gas':
                                                   0,
                                                   'gasPrice':
                                                   0
                                               })
     return self.send_custom(token_address, 0, transaction['data'],
                             **kwargs)
Exemplo n.º 6
0
 def send_erc721(self, to: str, token_address: str, token_id: int,
                 **kwargs) -> bool:
     transaction = (get_erc721_contract(
         self.ethereum_client.w3,
         token_address).functions.transferFrom(self.address, to,
                                               token_id).buildTransaction({
                                                   "from":
                                                   self.address,
                                                   "gas":
                                                   0,
                                                   "gasPrice":
                                                   0
                                               }))
     return self.send_custom(token_address, 0, transaction["data"],
                             **kwargs)
Exemplo n.º 7
0
    def get_supported_contracts(self) -> List[Type[Contract]]:
        supported_contracts = super().get_supported_contracts()

        aave_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (aave_a_token, aave_lending_pool,
                        aave_lending_pool_addresses_provider,
                        aave_lending_pool_core)
        ]
        initializable_admin_upgradeability_proxy_contracts = [
            self.dummy_w3.eth.contract(
                abi=initializable_admin_upgradeability_proxy_abi)
        ]
        balancer_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (balancer_bactions, balancer_exchange_proxy)
        ]
        chainlink_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (chainlink_token_abi, )
        ]
        compound_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (ctoken_abi, comptroller_abi)
        ]
        idle_contracts = [
            self.dummy_w3.eth.contract(abi=abi) for abi in (idle_token_v3, )
        ]
        maker_dao_contracts = [
            self.dummy_w3.eth.contract(abi=abi) for abi in maker_dao_abis
        ]
        open_zeppelin_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (open_zeppelin_admin_upgradeability_proxy,
                        open_zeppelin_proxy_admin)
        ]
        request_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (request_erc20_proxy, request_erc20_swap_to_pay,
                        request_ethereum_proxy)
        ]
        sablier_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (sablier_ctoken_manager, sablier_payroll, sablier_abi)
        ]

        snapshot_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (snapshot_delegate_registry_abi, )
        ]

        exchanges = [
            get_uniswap_exchange_contract(self.dummy_w3),
            get_kyber_network_proxy_contract(self.dummy_w3)
        ]

        sight_contracts = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (conditional_token_abi, market_maker_abi,
                        market_maker_factory_abi)
        ]
        gnosis_protocol = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (gnosis_protocol_abi, fleet_factory_deterministic_abi,
                        fleet_factory_abi)
        ]

        gnosis_safe = [
            self.dummy_w3.eth.contract(abi=abi)
            for abi in (allowance_module_abi, )
        ]
        erc_contracts = [
            get_erc721_contract(self.dummy_w3),
            get_erc20_contract(self.dummy_w3)
        ]

        test_contracts = [
            self.dummy_w3.eth.contract(abi=decoging_test_abi)
        ]  # https://rinkeby.etherscan.io/address/0x479adf13cc2e1844451f71dcf0bf5194df53b14b#code

        timelock_contracts = [self.dummy_w3.eth.contract(abi=timelock_abi)]

        # Order is important. If signature is the same (e.g. renaming of `baseGas`) last elements in the list
        # will take preference
        return (test_contracts + timelock_contracts +
                initializable_admin_upgradeability_proxy_contracts +
                aave_contracts + balancer_contracts + chainlink_contracts +
                idle_contracts + maker_dao_contracts + request_contracts +
                sablier_contracts + snapshot_contracts +
                open_zeppelin_contracts + compound_contracts + exchanges +
                sight_contracts + gnosis_protocol + gnosis_safe +
                erc_contracts + self.multisend_contracts + supported_contracts)
Exemplo n.º 8
0
 def send_erc721(self, address: str, token_address: str, token_id: int) -> bool:
     transaction = get_erc721_contract(self.ethereum_client.w3, token_address).functions.transferFrom(
         self.address, address, token_id
     ).buildTransaction({'from': self.address, 'gas': 0, 'gasPrice': 0})
     return self.execute_safe_transaction(token_address, 0, transaction['data'])