Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-zero price discovery buyer cancelation for price discovery offers #945

Closed
zajck opened this issue May 13, 2024 · 0 comments · Fixed by #946
Closed

Allow non-zero price discovery buyer cancelation for price discovery offers #945

zajck opened this issue May 13, 2024 · 0 comments · Fixed by #946
Assignees

Comments

@zajck
Copy link
Member

zajck commented May 13, 2024

Currently, price discovery offers require its price to be set to zero:

if (_offer.priceType == PriceType.Discovery && _offer.price != 0) revert InvalidPriceDiscoveryPrice();

This is to ensure that the offerPrice in releaseFunds is correct in all subsequent calculations. If we didn't require zero price at offer creation time, we'd need to handle it here.

uint256 offerPrice = offer.price;

As a consequence, the buyer cancellation penalty is restricted to 0

if (_offer.buyerCancelPenalty > offerPrice) revert InvalidOfferPenalty();

This imposes restrictions for price discovery offers, while at the same time buyer cancellation penalty works ok with the static offers, even when they are used in secondary commit. All that needs to be checked is that the actual price is high enough to cover cancellation penalty:

if (thisExchangeCost.price < offer.buyerCancelPenalty) revert PriceDoesNotCoverPenalty();

We should allow for buyer cancellation penalty in price discovery offers as well. It would then also serve as some sort of reserved price, since the protocol won't allow lower prices.
Steps to enable it:

  • remove restrictions in storeOffer
  • properly handle offerPrice in releaseFunds
  • add check-in commitToPriceDiscoveryOffer to make sure actualPrice is greater than the buyer cancellation penalty. Maybe the check can be moved into priceDiscoveryBase, so that both the price discovery handler and sequential commit handler would use the same code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants