mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Fix conflicts
This commit is contained in:
parent
2aebb4d912
commit
0fdeaf227c
2 changed files with 16 additions and 16 deletions
|
@ -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_core/crypto_currency.dart';
|
||||||
import 'package:cw_ethereum/deuro/deuro_savings_contract.dart';
|
import 'package:cw_ethereum/deuro/deuro_savings_contract.dart';
|
||||||
import 'package:cw_ethereum/ethereum_wallet.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_exceptions.dart';
|
||||||
import 'package:cw_evm/evm_chain_transaction_priority.dart';
|
import 'package:cw_evm/evm_chain_transaction_priority.dart';
|
||||||
import 'package:cw_evm/pending_evm_chain_transaction.dart';
|
import 'package:cw_evm/pending_evm_chain_transaction.dart';
|
||||||
|
import 'package:web3dart/crypto.dart';
|
||||||
import 'package:web3dart/web3dart.dart';
|
import 'package:web3dart/web3dart.dart';
|
||||||
|
|
||||||
const String savingsGatewayAddress = "0x073493d73258C4BEb6542e8dd3e1b2891C972303";
|
const String savingsGatewayAddress = "0x073493d73258C4BEb6542e8dd3e1b2891C972303";
|
||||||
|
|
||||||
const String dEuroAddress = "0xbA3f535bbCcCcA2A154b573Ca6c5A49BAAE0a3ea";
|
const String dEuroAddress = "0xbA3f535bbCcCcA2A154b573Ca6c5A49BAAE0a3ea";
|
||||||
|
const String frontendCode = "0x00000000000000000000000000000000000000000043616b652057616c6c6574";
|
||||||
|
|
||||||
class DEuro {
|
class DEuro {
|
||||||
final SavingsGateway _savingsGateway;
|
final SavingsGateway _savingsGateway;
|
||||||
|
@ -35,8 +33,6 @@ class DEuro {
|
||||||
client: client,
|
client: client,
|
||||||
);
|
);
|
||||||
|
|
||||||
final frontendCode = Uint8List.fromList(sha256.convert(utf8.encode("wallet")).bytes);
|
|
||||||
|
|
||||||
EthereumAddress get _address => EthereumAddress.fromHex(_wallet.walletAddresses.primaryAddress);
|
EthereumAddress get _address => EthereumAddress.fromHex(_wallet.walletAddresses.primaryAddress);
|
||||||
|
|
||||||
Future<BigInt> get savingsBalance async =>
|
Future<BigInt> get savingsBalance async =>
|
||||||
|
@ -57,11 +53,11 @@ class DEuro {
|
||||||
contractAddress: _savingsGateway.self.address.hexEip55,
|
contractAddress: _savingsGateway.self.address.hexEip55,
|
||||||
receivingAddressHex: _savingsGateway.self.address.hexEip55,
|
receivingAddressHex: _savingsGateway.self.address.hexEip55,
|
||||||
priority: priority,
|
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 estimatedGasFee = BigInt.from(gasFeesModel.estimatedGasFee);
|
||||||
|
|
||||||
final requiredBalance = estimatedGasFee;
|
final requiredBalance = estimatedGasFee;
|
||||||
|
|
||||||
if (currentBalance < requiredBalance) {
|
if (currentBalance < requiredBalance) {
|
||||||
|
@ -78,7 +74,7 @@ class DEuro {
|
||||||
await _checkEthBalanceForGasFees(priority);
|
await _checkEthBalanceForGasFees(priority);
|
||||||
|
|
||||||
final signedTransaction = await _savingsGateway.save(
|
final signedTransaction = await _savingsGateway.save(
|
||||||
(amount: amount, frontendCode: frontendCode),
|
(amount: amount, frontendCode: hexToBytes(frontendCode)),
|
||||||
credentials: _wallet.evmChainPrivateKey,
|
credentials: _wallet.evmChainPrivateKey,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -115,7 +111,7 @@ class DEuro {
|
||||||
await _checkEthBalanceForGasFees(priority);
|
await _checkEthBalanceForGasFees(priority);
|
||||||
|
|
||||||
final signedTransaction = await _savingsGateway.withdraw(
|
final signedTransaction = await _savingsGateway.withdraw(
|
||||||
(target: _address, amount: amount, frontendCode: frontendCode),
|
(target: _address, amount: amount, frontendCode: hexToBytes(frontendCode)),
|
||||||
credentials: _wallet.evmChainPrivateKey,
|
credentials: _wallet.evmChainPrivateKey,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -124,7 +120,7 @@ class DEuro {
|
||||||
contractAddress: _savingsGateway.self.address.hexEip55,
|
contractAddress: _savingsGateway.self.address.hexEip55,
|
||||||
receivingAddressHex: _savingsGateway.self.address.hexEip55,
|
receivingAddressHex: _savingsGateway.self.address.hexEip55,
|
||||||
priority: priority,
|
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);
|
final sendTransaction = () => _wallet.getWeb3Client()!.sendRawTransaction(signedTransaction);
|
||||||
|
|
|
@ -41,14 +41,18 @@ class UnspentCoinsListPage extends BasePage {
|
||||||
final UnspentCoinsListViewModel unspentCoinsListViewModel;
|
final UnspentCoinsListViewModel unspentCoinsListViewModel;
|
||||||
|
|
||||||
Future<void> handleOnPopInvoked(BuildContext context) async {
|
Future<void> handleOnPopInvoked(BuildContext context) async {
|
||||||
|
final navigator = Navigator.of(context);
|
||||||
final hasChanged = unspentCoinsListViewModel.hasAdjustableFieldChanged;
|
final hasChanged = unspentCoinsListViewModel.hasAdjustableFieldChanged;
|
||||||
if (unspentCoinsListViewModel.items.isEmpty || !hasChanged) {
|
if (unspentCoinsListViewModel.items.isEmpty || !hasChanged) {
|
||||||
Navigator.of(context).pop();
|
if (navigator.canPop()) navigator.pop();
|
||||||
} else {
|
return;
|
||||||
unspentCoinsListViewModel.setIsDisposing(true);
|
|
||||||
await unspentCoinsListViewModel.dispose();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unspentCoinsListViewModel.setIsDisposing(true);
|
||||||
|
await unspentCoinsListViewModel.dispose();
|
||||||
|
|
||||||
|
if (navigator.canPop()) navigator.pop();
|
||||||
|
if (navigator.canPop()) navigator.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue