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

Eliminación de ofertas al completar álbum de 120 #358

Open
dappsar opened this issue Apr 16, 2024 · 1 comment
Open

Eliminación de ofertas al completar álbum de 120 #358

dappsar opened this issue Apr 16, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@dappsar
Copy link
Collaborator

dappsar commented Apr 16, 2024

Comportamiento actual

Al compeltar el album de 120, borra TODAS las ofertas de las cartas del usuario (estuvieran en el álbum o no).
Con ello, se tienen que volver a publicar las cartas deseas, pagando nuevamente los fee de la red.

Comportamiento Esperado

Opción 1: Emitir un warning en la landing para comunicar que se borrarán las ofertas de todas las cartas, en la acción de completar el álbum.
Opción 2: Mejorar el método de completar el álbum para que solo borre las ofertas de las cartas del álbum.

@dappsar dappsar added the enhancement New feature or request label Apr 16, 2024
@dappsar dappsar self-assigned this Apr 16, 2024
@dappsar
Copy link
Collaborator Author

dappsar commented Apr 16, 2024

Album 60, check de cartas con ofertas:

    bool userHasOffers = (gammaOffersContract.getOffersByUserCounter(msg.sender) > 0);
    uint256 cardNumbersLength = cardNumbers.length;
    for (uint256 i; i < cardNumbersLength;) {
      if(s_cardsByUser[msg.sender][cardNumbers[i]] == 0) revert UserDoesNotHaveCardOrAlbum();
      if (userHasOffers) {
        if (gammaOffersContract.hasOffer(msg.sender, cardNumbers[i])) {
          if(s_cardsByUser[msg.sender][cardNumbers[i]] < 2) revert InsufficientCards();
        }
      }
      s_cardsByUser[msg.sender][cardNumbers[i]]--;
      unchecked {
        i++;
      }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant