Fix conflicts

This commit is contained in:
Blazebrain 2025-06-27 10:07:43 +01:00
parent 2aebb4d912
commit 0fdeaf227c
2 changed files with 16 additions and 16 deletions

View file

@ -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<BigInt> 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);

View file

@ -41,14 +41,18 @@ class UnspentCoinsListPage extends BasePage {
final UnspentCoinsListViewModel unspentCoinsListViewModel;
Future<void> 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