|
9 | 9 | #include <hive/protocol/crypto_memo.hpp>
|
10 | 10 | #include <hive/protocol/transaction_util.hpp>
|
11 | 11 | #include <hive/protocol/version.hpp>
|
| 12 | +#include <hive/protocol/hive_collateral.hpp> |
12 | 13 | #include <hive/wallet/wallet.hpp>
|
13 | 14 | #include <hive/wallet/api_documentation.hpp>
|
14 | 15 | #include <hive/wallet/reflect_util.hpp>
|
@@ -2163,14 +2164,11 @@ wallet_serializer_wrapper<hive::protocol::asset> wallet_api::estimate_hive_colla
|
2163 | 2164 | //must reflect calculations from collateralized_convert_evaluator::do_apply
|
2164 | 2165 |
|
2165 | 2166 | auto fhistory = get_feed_history().value;
|
2166 |
| - FC_ASSERT( !static_cast<price>( fhistory.current_median_history ).is_null(), "Cannot estimate conversion collateral because there is no price feed." ); |
2167 | 2167 |
|
2168 |
| - auto needed_hive = multiply_with_fee( hbd_amount_to_get.value, fhistory.current_min_history, |
2169 |
| - HIVE_COLLATERALIZED_CONVERSION_FEE, HIVE_SYMBOL ); |
2170 |
| - uint128_t _amount = ( uint128_t( needed_hive.amount.value ) * HIVE_CONVERSION_COLLATERAL_RATIO ) / HIVE_100_PERCENT; |
2171 |
| - asset required_collateral = asset( fc::uint128_to_uint64(_amount), HIVE_SYMBOL ); |
2172 |
| - |
2173 |
| - return { required_collateral }; |
| 2168 | + return { hive::protocol::hive_collateral::estimate_hive_collateral( |
| 2169 | + fhistory.current_median_history, |
| 2170 | + fhistory.current_min_history, |
| 2171 | + hbd_amount_to_get.value ) }; |
2174 | 2172 | }
|
2175 | 2173 |
|
2176 | 2174 | wallet_signed_transaction wallet_api::publish_feed(
|
|
0 commit comments