bitshares / bitshares-core

BitShares Blockchain node and command-line wallet
https://bitshares.github.io/
Other
1.17k stars 648 forks source link

Document `fees` returned by `liquidity_pool_exchange_operation` #2346

Closed abitmore closed 3 years ago

abitmore commented 3 years ago

User Story

As an API user / client developer I'd like to know more about the fees returned in liquidity pool operations so that it is easier to understand and use the data. Specifically, liquidity_pool_exchange_operation returns 3 items in the fees vector, without proper documentation it's hard to know which fee is paid to whom for what purpose.

A typical processed operation is like this:

{"id":"5.4.3683","pool":"1.19.0","sequence":112,"time":"2020-11-11T00:28:30","op_type":63,"op":{"id":"0.0.0","op":[63,{"fee":{"amount":100000,"asset_id":"1.3.0"},"account":"1.2.989566","pool":"1.19.0","amount_to_sell":{"amount":6591000,"asset_id":"1.3.0"},"min_to_receive":{"amount":972000,"asset_id":"1.3.3291"},"extensions":[]}],"result":[4,{"paid":[{"amount":6591000,"asset_id":"1.3.0"}],"received":[{"amount":972197,"asset_id":"1.3.3291"}],"fees":[{"amount":0,"asset_id":"1.3.0"},{"amount":1948,"asset_id":"1.3.3291"},{"amount":4895,"asset_id":"1.3.3291"}]}],"block_num":53104086,"trx_in_block":0,"op_in_trx":0,"virtual_op":0}}

Actually, the fees returned for liquidity_pool_exchange_operation are in this order, see code https://github.com/bitshares/bitshares-core/blob/80fe3cbf1fb431d2ebb801a0a48f2340bc7276ad/libraries/chain/liquidity_pool_evaluator.cpp#L405-L407

Impacts Describe which portion(s) of BitShares Core may be impacted by your request. Please tick at least one box.

CORE TEAM TASK LIST

abitmore commented 3 years ago

Fixed by #2404.