def get_liquidity_logs( self, event_name: str, from_block: int, to_block: Optional[int] = None, user_address: Optional[str] = None, this_pool_only: bool = True, ) -> Tuple: """ :param event_name: str, one of LOG_JOIN, LOG_EXIT, LOG_SWAP """ topic0 = self.get_event_signature(event_name) to_block = to_block or "latest" topics = [topic0] if user_address: assert Web3.isChecksumAddress(user_address) topics.append( f"0x000000000000000000000000{remove_0x_prefix(user_address).lower()}" ) event = getattr(self.events, event_name) argument_filters = {"topics": topics} logs = self.getLogs( event(), argument_filters=argument_filters, fromBlock=from_block, toBlock=to_block, from_all_addresses=not this_pool_only, ) return logs
def send_ether(from_wallet: Wallet, to_address: str, amount: int) -> AttributeDict: if not Web3.isChecksumAddress(to_address): to_address = Web3.toChecksumAddress(to_address) web3 = from_wallet.web3 chain_id = web3.eth.chain_id tx = { "from": from_wallet.address, "to": to_address, "value": amount, "chainId": chain_id, "gasPrice": get_gas_price(web3), } tx["gas"] = web3.eth.estimate_gas(tx) raw_tx = from_wallet.sign_tx(tx) tx_hash = web3.eth.send_raw_transaction(raw_tx) block_confirmations = from_wallet.block_confirmations.value block_number_poll_interval = BLOCK_NUMBER_POLL_INTERVAL[chain_id] transaction_timeout = from_wallet.transaction_timeout.value wait_for_transaction_receipt_and_block_confirmations( web3, tx_hash, block_confirmations, block_number_poll_interval, transaction_timeout, ) return web3.eth.get_transaction_receipt(tx_hash)