diff --git a/tests/integration/test_wallet.py b/tests/integration/test_wallet.py index 528e973..9783dc8 100644 --- a/tests/integration/test_wallet.py +++ b/tests/integration/test_wallet.py @@ -188,7 +188,10 @@ def test_prepare_deposit_transaction_token(self): transaction = self.wallet.prepare_deposit_tx( DepositTransaction( - token=l1_address, amount=5, refund_recipient=self.wallet.address, approve_erc20=True + token=l1_address, + amount=5, + refund_recipient=self.wallet.address, + approve_erc20=True, ) ) @@ -806,7 +809,9 @@ def test_withdraw_eth_paymaster(self): paymaster_balance_before = self.zksync.zksync.zks_get_balance(paymaster_address) paymaster_token_balance_before = self.zksync.zksync.zks_get_balance( - paymaster_address, token_address=token_address, block_tag=ZkBlockParams.LATEST + paymaster_address, + token_address=token_address, + block_tag=ZkBlockParams.LATEST, ) sender_balance_before = self.wallet.get_balance() @@ -847,7 +852,9 @@ def test_withdraw_eth_paymaster(self): ) paymaster_balance_after = self.zksync.zksync.zks_get_balance(paymaster_address) paymaster_token_balance_after = self.zksync.zksync.zks_get_balance( - paymaster_address, token_address=token_address, block_tag=ZkBlockParams.LATEST + paymaster_address, + token_address=token_address, + block_tag=ZkBlockParams.LATEST, ) sender_balance_after = self.wallet.get_balance() sender_approval_token_balance_after = self.wallet.get_balance( @@ -858,9 +865,7 @@ def test_withdraw_eth_paymaster(self): self.assertEqual( paymaster_token_balance_after - paymaster_token_balance_before, 1 ) - self.assertEqual( - sender_balance_before - sender_balance_after, amount - ) + self.assertEqual(sender_balance_before - sender_balance_after, amount) self.assertEqual( sender_approval_token_balance_after, sender_approval_token_balance_before - 1, diff --git a/tests/integration/test_zksync_web3.py b/tests/integration/test_zksync_web3.py index 5325a08..fdd26a1 100644 --- a/tests/integration/test_zksync_web3.py +++ b/tests/integration/test_zksync_web3.py @@ -19,7 +19,12 @@ ADDRESS_DEFAULT, StorageProof, ) -from zksync2.core.utils import pad_front_bytes, to_bytes, pad_back_bytes, L2_BASE_TOKEN_ADDRESS +from zksync2.core.utils import ( + pad_front_bytes, + to_bytes, + pad_back_bytes, + L2_BASE_TOKEN_ADDRESS, +) from zksync2.manage_contracts.contract_encoder_base import ( ContractEncoder, JsonConfiguration, @@ -768,9 +773,6 @@ def test_contract_factory(self): def test_get_all_account_balances(self): balances = self.web3.zksync.zks_get_all_account_balances(self.account.address) - # @skip("Integration test, used for develop purposes only") - def test_get_token_price(self): - price = self.web3.zksync.zks_get_token_price(self.ETH_TOKEN.l2_address) # @skip("Integration test, used for develop purposes only") def test_get_l1_chain_id(self): diff --git a/zksync2/account/wallet_l1.py b/zksync2/account/wallet_l1.py index b0c5d86..747c493 100644 --- a/zksync2/account/wallet_l1.py +++ b/zksync2/account/wallet_l1.py @@ -1147,7 +1147,12 @@ def finalize_withdrawal(self, withdraw_hash, index: int = 0): nonce=self._eth_web3.eth.get_transaction_count(self.address), ) - shared_bridge = self.get_l1_bridge_contracts().shared + shared_bridge_address = ( + self._zksync_web3.zksync.zks_get_bridge_contracts().shared_l1_default_bridge + ) + shared_bridge = self._eth_web3.eth.contract( + address=shared_bridge_address, abi=l1_shared_bridge_abi_default() + ) tx = shared_bridge.functions.finalizeWithdrawal( self._zksync_web3.eth.chain_id, params["l1_batch_number"], @@ -1189,7 +1194,7 @@ def is_withdrawal_finalized(self, withdraw_hash, index: int = 0): abi=l1_shared_bridge_abi_default(), ) - return l1_bridge.functions.isWithdrawalFinalizedShared( + return l1_bridge.functions.isWithdrawalFinalizedShared( self._zksync_web3.eth.chain_id, int(log["l1BatchNumber"], 16), proof.id ).call() diff --git a/zksync2/account/wallet_l2.py b/zksync2/account/wallet_l2.py index 059e71f..af0281e 100644 --- a/zksync2/account/wallet_l2.py +++ b/zksync2/account/wallet_l2.py @@ -98,7 +98,9 @@ def transfer(self, tx: TransferTransaction) -> HexStr: ) if tx.options.gas_limit is None or tx.options.gas_limit == 0: - tx.options.gas_limit = self._zksync_web3.zksync.eth_estimate_gas(tx_fun_call.tx) + tx.options.gas_limit = self._zksync_web3.zksync.eth_estimate_gas( + tx_fun_call.tx + ) tx_712 = tx_fun_call.tx712(tx.options.gas_limit) signer = PrivateKeyEthSigner(self._l1_account, tx.options.chain_id) @@ -123,9 +125,11 @@ def withdraw(self, tx: WithdrawTransaction): tx, from_=self._l1_account.address ) if tx.options.gas_limit is None: - transaction.tx['gas'] = self._zksync_web3.zksync.eth_estimate_gas(transaction.tx) + transaction.tx["gas"] = self._zksync_web3.zksync.eth_estimate_gas( + transaction.tx + ) else: - transaction.tx['gas'] = tx.options.gas_limit + transaction.tx["gas"] = tx.options.gas_limit tx_712 = transaction.tx712() signer = PrivateKeyEthSigner(self._l1_account, self._zksync_web3.eth.chain_id) signed_message = signer.sign_typed_data(tx_712.to_eip712_struct()) diff --git a/zksync2/module/zksync_module.py b/zksync2/module/zksync_module.py index 2047cff..6bb0e76 100644 --- a/zksync2/module/zksync_module.py +++ b/zksync2/module/zksync_module.py @@ -770,7 +770,7 @@ def get_withdraw_transaction( token=tx.token, bridge_address=tx.bridge_address, from_=from_, - paymaster_params=tx.paymaster_params + paymaster_params=tx.paymaster_params, ) return transaction