From 0fdeaf227c117c5535279912e9351c2e5d3b051e Mon Sep 17 00:00:00 2001 From: Blazebrain Date: Fri, 27 Jun 2025 10:07:43 +0100 Subject: [PATCH] Fix conflicts --- cw_ethereum/lib/deuro/deuro_savings.dart | 18 +++++++----------- .../unspent_coins/unspent_coins_list_page.dart | 14 +++++++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cw_ethereum/lib/deuro/deuro_savings.dart b/cw_ethereum/lib/deuro/deuro_savings.dart index 32f817d8d..b5a5db4a9 100644 --- a/cw_ethereum/lib/deuro/deuro_savings.dart +++ b/cw_ethereum/lib/deuro/deuro_savings.dart @@ -1,7 +1,3 @@ -import 'dart:convert'; -import 'dart:typed_data'; - -import 'package:crypto/crypto.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_ethereum/deuro/deuro_savings_contract.dart'; import 'package:cw_ethereum/ethereum_wallet.dart'; @@ -9,11 +5,13 @@ import 'package:cw_evm/contract/erc20.dart'; import 'package:cw_evm/evm_chain_exceptions.dart'; import 'package:cw_evm/evm_chain_transaction_priority.dart'; import 'package:cw_evm/pending_evm_chain_transaction.dart'; +import 'package:web3dart/crypto.dart'; import 'package:web3dart/web3dart.dart'; const String savingsGatewayAddress = "0x073493d73258C4BEb6542e8dd3e1b2891C972303"; const String dEuroAddress = "0xbA3f535bbCcCcA2A154b573Ca6c5A49BAAE0a3ea"; +const String frontendCode = "0x00000000000000000000000000000000000000000043616b652057616c6c6574"; class DEuro { final SavingsGateway _savingsGateway; @@ -35,8 +33,6 @@ class DEuro { client: client, ); - final frontendCode = Uint8List.fromList(sha256.convert(utf8.encode("wallet")).bytes); - EthereumAddress get _address => EthereumAddress.fromHex(_wallet.walletAddresses.primaryAddress); Future get savingsBalance async => @@ -57,11 +53,11 @@ class DEuro { contractAddress: _savingsGateway.self.address.hexEip55, receivingAddressHex: _savingsGateway.self.address.hexEip55, priority: priority, - data: _savingsGateway.self.abi.functions[17].encodeCall([BigInt.zero, frontendCode]), + data: _savingsGateway.self.abi.functions[17] + .encodeCall([BigInt.zero, hexToBytes(frontendCode)]), ); final estimatedGasFee = BigInt.from(gasFeesModel.estimatedGasFee); - final requiredBalance = estimatedGasFee; if (currentBalance < requiredBalance) { @@ -78,7 +74,7 @@ class DEuro { await _checkEthBalanceForGasFees(priority); final signedTransaction = await _savingsGateway.save( - (amount: amount, frontendCode: frontendCode), + (amount: amount, frontendCode: hexToBytes(frontendCode)), credentials: _wallet.evmChainPrivateKey, ); @@ -115,7 +111,7 @@ class DEuro { await _checkEthBalanceForGasFees(priority); final signedTransaction = await _savingsGateway.withdraw( - (target: _address, amount: amount, frontendCode: frontendCode), + (target: _address, amount: amount, frontendCode: hexToBytes(frontendCode)), credentials: _wallet.evmChainPrivateKey, ); @@ -124,7 +120,7 @@ class DEuro { contractAddress: _savingsGateway.self.address.hexEip55, receivingAddressHex: _savingsGateway.self.address.hexEip55, priority: priority, - data: _savingsGateway.self.abi.functions[17].encodeCall([amount, frontendCode]), + data: _savingsGateway.self.abi.functions[17].encodeCall([amount, hexToBytes(frontendCode)]), ); final sendTransaction = () => _wallet.getWeb3Client()!.sendRawTransaction(signedTransaction); diff --git a/lib/src/screens/unspent_coins/unspent_coins_list_page.dart b/lib/src/screens/unspent_coins/unspent_coins_list_page.dart index 965926d63..3c47ea203 100644 --- a/lib/src/screens/unspent_coins/unspent_coins_list_page.dart +++ b/lib/src/screens/unspent_coins/unspent_coins_list_page.dart @@ -41,14 +41,18 @@ class UnspentCoinsListPage extends BasePage { final UnspentCoinsListViewModel unspentCoinsListViewModel; Future handleOnPopInvoked(BuildContext context) async { + final navigator = Navigator.of(context); final hasChanged = unspentCoinsListViewModel.hasAdjustableFieldChanged; if (unspentCoinsListViewModel.items.isEmpty || !hasChanged) { - Navigator.of(context).pop(); - } else { - unspentCoinsListViewModel.setIsDisposing(true); - await unspentCoinsListViewModel.dispose(); - Navigator.of(context).pop(); + if (navigator.canPop()) navigator.pop(); + return; } + + unspentCoinsListViewModel.setIsDisposing(true); + await unspentCoinsListViewModel.dispose(); + + if (navigator.canPop()) navigator.pop(); + if (navigator.canPop()) navigator.pop(); } @override