* hv
* Change build version
This commit is contained in:
mkyq 2022-03-30 17:57:04 +02:00 committed by GitHub
parent e7e419bc83
commit 01150ef2a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
213 changed files with 23972 additions and 672 deletions

View file

@ -0,0 +1,21 @@
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/monero_amount_format.dart';
import 'package:cw_haven/api/balance_list.dart';
Future<void> updateHavenRate(FiatConversionStore fiatConversionStore) async {
final rate = getRate();
final base = rate.firstWhere((row) => row.getAssetType() == 'XUSD', orElse: () => null);
rate.forEach((row) {
final cur = CryptoCurrency.fromString(row.getAssetType());
final baseRate = moneroAmountToDouble(amount: base.getRate());
final rowRate = moneroAmountToDouble(amount: row.getRate());
if (cur == CryptoCurrency.xusd) {
fiatConversionStore.prices[cur] = 1.0;
return;
}
fiatConversionStore.prices[cur] = baseRate / rowRate;
});
}