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

seller locked funds is not correct in Finance Dashboard #739

Closed
levalleux-ludo opened this issue Jul 3, 2023 · 2 comments · Fixed by bosonprotocol/core-components#595 or #897
Closed
Assignees

Comments

@levalleux-ludo
Copy link
Member

levalleux-ludo commented Jul 3, 2023

completed exchanges should be excluded when coputing the locked funds value

Fix should be done in core-components/subgraph package
Proposed fix:

  • add exchange.finalizedDate = event.block.timestamp; in packages\subgraph\src\mappings\exchange-handler.ts line 214 (just after setting exchange.completedDate

E2e test should be added to check the fix:

  • create a seller
  • seller creates an offer with quantity >= 5, price = 1, sellerDeposit = 0.1, buyerCancellationPenalty = 0.01
  • seller deposit funds >= 0.5 for sellerDeposit
  • create a buyer
  • buyer commits 5 times to the offer
  • buyer cancel exchange Ex1
  • buyer redeem exchange Ex2
  • buyer redeem exchange Ex3 and raise a dispute
  • buyer redeem exchange Ex4 and complete it
  • seller revoke exchange Ex5
  • check seller available funds: 0.01 (exchange Ex1) + 1 (exchange Ex4) - 0.1 (exchange Ex5) = 0.91
  • check seller locked funds (use the same logic than the dApp src\components\seller\common\useOffersBacked.ts l.74): 0.2 (exchanges Ex2, Ex3)
  • check buyer available funds: 0.1 (exchange Ex5)
@albertfolch-redeemeum albertfolch-redeemeum self-assigned this Oct 20, 2023
@albertfolch-redeemeum
Copy link
Contributor

albertfolch-redeemeum commented Oct 23, 2023

check seller available funds: 1.01 (exchange Ex1) + (1.1 -0.005(protocol fee))(exchange Ex4) - 0 (exchange Ex5, seller payout is 0) = 2.105

check buyer available funds: 1.1 (exchange Ex5)

@levalleux-ludo
Copy link
Member Author

Exchange 1 is cancelled by the buyer. Item price goes back to the buyer, minus the cancellation penalty that goes to the seller.
OK for adding the protocol fee for Exchange 4

What about?

  • seller available funds: 0.5 (initial deposit) + 0.01 (exchange Ex1) - 0.1 (locked Ex2) - 0.1 (locked Ex3) + (1-0.005(protocol fee))(exchange Ex4) - 0.1 (penalty Ex5) = 1.205
  • seller locked funds: 0.1 (locked Ex2) + 0.1 (locked Ex3) = 0.2
  • buyer locked funds: 1 (Ex2) + 1 (Ex3) = 2
  • buyer available funds: (1-0.01) (Ex1) + (1+0.1) (exchange Ex5) = 2.09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants