BSIP: 0074
Title: Margin Call Fee Ratio
Authors:
Jerry Liu bitcrab@qq.com
Status: Draft
Type: Protocol
Created: 2019-09-07
Discussion: https://github.com/bitshares/bsips/issues/164
Worker: TBD
Making all in src | |
make[1]: Entering directory '/home/jmjatlanta/Development/cpp/komodo/src' | |
make[2]: Entering directory '/home/jmjatlanta/Development/cpp/komodo/src' | |
CXX komodod-bitcoind.o | |
CXX libbitcoin_server_a-sendalert.o | |
CXX cc/libbitcoin_server_a-eval.o | |
CXX cc/libbitcoin_server_a-import.o | |
CXX cc/libbitcoin_server_a-importgateway.o | |
CXX cc/libbitcoin_server_a-CCassetsCore.o | |
CXX cc/libbitcoin_server_a-CCcustom.o |
Accumulated Fees and BSIP74/87
Fees for margin calls and forced settlement should be deposited in a fee object of the asset object, later to be claimed by someone with authority to claim them (normally the asset issuer).
An implementation issue is that the current asset_dynamic_data_object::accumulated_fees
is always denominated in the asset itself. Fees for margin calls and forced settlement is collected in the collateral asset, not the debt asset. Therefore, the amount can not be added to accumulated_fees
.
To remedy this situation, it is proposed that an additional field be added to the asset_dynamic_data_object
for the storage of margin call/forced settlement fees. It will always be denominated in the collateral asset.
Such a change will require:
- API calls to claim the balance
- additional checks that the balance is 0 before permitting the collateral asset to be changed.
TBD: Will adding to asset_dynamic_data_object
cause protocol serialization problems (no extensions
field)
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
secp256k1.vcxproj -> C:\Development\cpp\bitshares-core-pmconrad\build\libraries\fc\Release\secp256k1.lib | |
fc.vcxproj -> C:\Development\cpp\bitshares-core-pmconrad\build\libraries\fc\Release\fc.lib | |
cl : Command line warning D9002: ignoring unknown option '-fPIC' [C:\Development\cpp\bitshares-core-pmconrad\build\libraries\protocol\graphene_protocol.vcxproj] | |
account.cpp | |
cl : Command line warning D9002: ignoring unknown option '-fPIC' [C:\Development\cpp\bitshares-core-pmconrad\build\libraries\fc\tests\all_tests.vcxproj] | |
stacktrace_test.cpp | |
C:\Development\cpp\bitshares-core-pmconrad\libraries\protocol\include\graphene/protocol/types.hpp(261): warning C4003: not enough arguments for function-like macro invocation 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY' [C:\Development\cpp\bitshares-core-pmconrad\build\libraries\protocol\graphene_protocol.vcxproj] |
BOOST_AUTO_TEST_CASE( exception_in_thread ) | |
{ | |
fc::thread thread("my"); | |
std::atomic<int> counter; | |
counter = 0; | |
class my_exception : public std::exception | |
{ | |
public: |
{ | |
"initial_timestamp": "2016-01-18T09:18:25", | |
"max_core_supply": "1000000000000000", | |
"initial_parameters": { | |
"current_fees": { | |
"parameters": [[ | |
0,{ | |
"fee": 2000000, | |
"price_per_kbyte": 1000000 | |
} |
1950456,1950598c1950456,1950598 | |
< {"id":"1.10.29277","expiration_time":"2019-05-17T15:06:15","proposed_transaction":{"ref_block_num":0,"ref_block_prefix":0,"expiration":"2019-05-17T15:06:15","operations":[[0,{"fee":{"amount":50000,"asset_id":"1.3.0"},"from":"1.2.466056","to":"1.2.382882","amount":{"amount":500000,"asset_id":"1.3.5303"},"memo":{"from":"BTS7gDsXig5wwDjZRr7ewx2w1fvcefG23pNnppc3BBcEPeTK2Z7M5","to":"BTS6yQ2HkAWfZvrGTwHSDQyBxNgAGqbsNYT9gkqpQks7iZ2FFwqib","nonce":"202400808233984","message":"d3762680875af8f92ed67b66df9f829a"},"extensions":[]}]],"extensions":[]},"required_active_approvals":["1.2.466056"],"available_active_approvals":["1.2.1016553","1.2.1016563"],"required_owner_approvals":[],"available_owner_approvals":[],"available_key_approvals":[],"proposer":"1.2.1016502"} | |
< {"id":"1.10.29908","expiration_time":"2019-05-16T10:15:32","proposed_transaction":{"ref_block_num":0,"ref_block_prefix":0,"expiration":"2019-05-16T10:15:32","operations":[[23,{"fee":{"amount":13061,"asset_id":"1.3.0"},"fee_pay |
1950456,1950598c1950456,1950598 | |
< {"id":"1.10.29277","expiration_time":"2019-05-17T15:06:15","proposed_transaction":{"ref_block_num":0,"ref_block_prefix":0,"expiration":"2019-05-17T15:06:15","operations":[[0,{"fee":{"amount":50000,"asset_id":"1.3.0"},"from":"1.2.466056","to":"1.2.382882","amount":{"amount":500000,"asset_id":"1.3.5303"},"memo":{"from":"BTS7gDsXig5wwDjZRr7ewx2w1fvcefG23pNnppc3BBcEPeTK2Z7M5","to":"BTS6yQ2HkAWfZvrGTwHSDQyBxNgAGqbsNYT9gkqpQks7iZ2FFwqib","nonce":"202400808233984","message":"d3762680875af8f92ed67b66df9f829a"},"extensions":[]}]],"extensions":[]},"required_active_approvals":["1.2.466056"],"available_active_approvals":["1.2.1016553","1.2.1016563"],"required_owner_approvals":[],"available_owner_approvals":[],"available_key_approvals":[],"proposer":"1.2.1016502"} | |
< {"id":"1.10.29908","expiration_time":"2019-05-16T10:15:32","proposed_transaction":{"ref_block_num":0,"ref_block_prefix":0,"expiration":"2019-05-16T10:15:32","operations":[[23,{"fee":{"amount":13061,"asset_id":"1.3.0"},"fee_pay |
/**** | |
* Attempt to have fc::threads use fc::mutex when yield() causes a context switch | |
*/ | |
BOOST_AUTO_TEST_CASE( yield_with_mutex ) | |
{ | |
// set up thread pool | |
uint16_t num_threads = 5; | |
std::vector<fc::thread*> thread_collection; | |
for(uint16_t i = 0; i < num_threads; i++) | |
thread_collection.push_back(new fc::thread("My" + std::to_string(i))); |
/*** | |
* This is a test to demonstrate what happens when a thread with | |
* a lock yields | |
*/ | |
#include <thread> | |
#include <mutex> | |
#include <iostream> | |
std::mutex blocker; | |
std::mutex logger; |