[bisq-network/bisq] CLI bug fix: show trade's contract volume, not moving offer volume (#5704)

Stan notifications at github.com
Sat Sep 18 17:31:37 CEST 2021

This fixes a an API CLI `gettrade` bug that could have resulted in loss of funds (explained below).  
There are two minor changes:

- Show correct, frozen `Buyer Cost` (trade volume, not offer volume) in CLI console.
This corrects the CLI's displayed fiat trade cost value, which should be trade.volume, not offer.volume.  Offer volume varies with BTC volatility, and the CLI should be showing the trade.volume value instead, frozen when the contract was made.

- Show correct, frozen altcoin `Amount`  (trade volume, not offer volume) in CLI console.
This corrects the CLI's displayed altcoin trade amount value, which should be trade.volume, not offer.volume.  The bug has been hidden by the stability of the BSQ price, and exposed while testing API support for XMR trades.

**The bug could have resulted in loss of funds for traders who used the API to buy BTC in the following scenario:**

	(1) A trader made or took a market-price-margin based offer to buy BTC, using the API.
	(2) The BTC price was volatile between the time the trade was taken and the payment was sent.
	(3) The payer did not pay the amount shown by the API CLI at the time the trade was created.

		She waited, then returned to the API to find out how much to pay -- minutes to days 
		after the contract was created -- when the trade price (volume) was frozen.  The CLI
		would have shown her a different amount in the `Buyer Cost` column than it showed 
		immediately after the trade was created.

The CLI's `gettrade` command has been showing the moving offer volume in the `Buyer Cost` column -- how 
much the buyer pays.  This value varies with BTC price if the offer is market-price-margin based.

The CLI should be showing the constant trade volume, frozen at the time a trade contract is written.

This bug does not affect BSQ trading because all BSQ trades are at fixed prices.
This bug would have affected XMR trading if the fix was not applied before XMR trading support in the API is released.

To check to see if you paid too much or too little, you could use the desktop app to view your trade history,
and match the correct payment amounts to your bank transfer records.
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * Show frozen fiat trade cost in CLI console
  * Show correct altcoin trade amount (volume) in CLI console

-- File Changes --

    M cli/src/main/java/bisq/cli/TradeFormat.java (4)
    M core/src/main/java/bisq/core/api/model/TradeInfo.java (12)
    M proto/src/main/proto/grpc.proto (1)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210918/5d401cc7/attachment-0001.htm>

More information about the bisq-github mailing list