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

fix: duplicate acceptance of offers using same tokens #284

Open
eduramme opened this issue Apr 11, 2024 · 3 comments
Open

fix: duplicate acceptance of offers using same tokens #284

eduramme opened this issue Apr 11, 2024 · 3 comments
Labels
bug Something isn't working hot task Doubled points in the reward table

Comments

@eduramme
Copy link
Contributor

Bug Report

Current behavior

It's possible to accept 2 different offers regarding the same token. The blockchain retrieves an error afterward but the frontend confirms the Swap anyways.

Expected behavior

It shouldn't be possible to accept 2 token offers with the same token after the first swap is confirmed.

Steps to reproduce

  1. Create 2 Token Offers for the same address with teh same token
  2. Accept the first offer (everything is okay)
  3. Accept the second offer (shouldn't be possible because the token is already swapped

Other information


@eduramme eduramme added the bug Something isn't working label Apr 11, 2024
@eduramme eduramme moved this to 🔖 TODO in Swaplace Apr 11, 2024
@0xneves
Copy link
Contributor

0xneves commented Apr 11, 2024

Hey @eduramme
I want to understand why the swap is being accepted in the front-end. As I remember, a swap is accepted in case the blockchain returns a successful transaction. And if the blockchain is returning an error, then the swap shouldn't be accepted in the front as the transaction reverting is a sign that we should not display the accept scenario.

I think the front-end is not handling the error correctly. Hence this is what I think needs to be done:

  • Await to handle the blockchain error and display the appropriate results
  • Simulate the transaction with Viem before actually casting it to make sure it is working

@0xneves 0xneves changed the title fix: Duplicate Acceptance of Offers Using Identical Tokens Due to Frontend Inconsistency fix: duplicate acceptance of offers using same tokens Apr 11, 2024
@eduramme
Copy link
Contributor Author

investigate simulateContract - Viem

@0xneves 0xneves added the hot task Doubled points in the reward table label Apr 19, 2024
@heronlancellot
Copy link
Member

heronlancellot commented Apr 22, 2024

hey yo ! any update of this task ? @eduramme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hot task Doubled points in the reward table
Projects
Status: 🔖 TODO
Development

No branches or pull requests

3 participants