Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Resolve issue where user can't delete their own listing if they are not the cheapest #683

Merged

Conversation

TatisLois
Copy link
Contributor

@TatisLois TatisLois commented Jan 12, 2022

Why

Resolves issue 326 where a user can't delete their own listing if they are not the cheapest

Issue is caused by submitting the wrong sale_identifier. This will refactor the code to find the current sellers listing and submit the correct sale_identifier

How

  1. The find my listing logic was used in two other places, making it a good candidate to be added as a util. Created one called findListingItemByOwner
  2. Refactored all the call sites
  3. In apps/next-react/src/components/UI/Modals/UnlistModal.jsx updated the unlist tx to use the owners item

Test Plan

  1. Created account A
  2. Created account B and minted a NFT with 100 editions
  3. Account B list the NFT at price 50 tkn
  4. Account B sends some editions to A
  5. Account A list the NFT at 100 tkn and then delist the NFT
  6. Account A list the NFT at 5 tkn and then delist the NFT

@linear
Copy link

linear bot commented Jan 12, 2022

SHOW2-326 Can't delete your own listing if you're not the cheapest

  1. mint something with 2 editions with address A
  2. transfer 1 to address B
  3. on address A, list for 1000 WETH
  4. on address B, list for 999 WETH
  5. refresh the page on address A, it should display "buy for 999 WETH"
  6. try to unlist with address A, it will fail with
_app-d095b59fb365b648.js:1 Uncaught (in promise) Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":48,\"error\":{\"code\":3,\"data\":\"0xd0052b600000000000000000000000000000000000000000000000000000000000000707\",\"message\":\"execution reverted\"}}","error":{"code":3,"data":"0xd0052b600000000000000000000000000000000000000000000000000000000000000707"},"requestBody":"{\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0x4feb2e0f7dfd8556be176bcdf5c9329a567976bf\",\"to\":\"0x022f3c027572fe1b321ba7a7844ab77ac4193650\",\"data\":\"0xbd94b0050000000000000000000000000000000000000000000000000000000000000707\"}],\"id\":48,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://polygon-mainnet.infura.io/v3/2c3481ef35a3443794f6272a371bd49b"}, method="estimateGas", transaction={"from":"0x4feB2E0F7DFD8556bE176BcDf5C9329A567976Bf","to":"0x022F3C027572FE1b321ba7a7844ab77aC4193650","data":"0xbd94b0050000000000000000000000000000000000000000000000000000000000000707","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.5.1)

The estimateGas failure is caused by the fact that A is trying to cancel B's listing (it is the one that is displayed, because it's the cheapest), but the transaction would fail because A does not own B's listing.

The fix is to pass the correct listing id to cancelSale when A requests to unlist

(note that in theory, A could have multiple listings for the same token id)

@vercel
Copy link

vercel bot commented Jan 12, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/showtime/showtime/D5ZN6woCxnxKbJPE5VGMyXHJeSbx
✅ Preview: https://showtime-git-feature-show2-326-cant-delete-your-0feb11-showtime.vercel.app

@TatisLois TatisLois changed the title fix(unlist): allow an item to be unlisted by the owner when it not th… Resolve issue where user can't delete their own listing if they are not the cheapest Jan 12, 2022
@github-actions
Copy link

PR Preview - Storybook

This pull request preview deployment is now available.

✅ Preview: io.showtime.storybook://expo-development-client/?url=https://exp.host/@tryshowtime/showtime-storybook-react-native/index.exp?release-channel=pr-683&sdkVersion=44.0.0

Comment ID:

@github-actions
Copy link

PR Preview - App

This pull request preview deployment is now available.

✅ Preview: io.showtime.development://expo-development-client/?url=https://exp.host/@tryshowtime/showtime/index.exp?release-channel=pr-683&sdkVersion=44.0.0

Comment ID:

Copy link

@m1guelpf m1guelpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TatisLois TatisLois merged commit e7b1caf into staging Jan 14, 2022
TatisLois added a commit that referenced this pull request Jan 17, 2022
* upgrade mmkv

* Home/Feed (#655)

* feed tabs

* pinch to zoom

* pinch to zoom

* pinch to zoom

* pinch to zoom

* fix: feed ptr

* fix: feed images

* fix: feed images

* wip: feed

* wip: feed

* wip: feed

* wip - feed

* wip - feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* wip: feed

* upgrade mmkv

* use correct app scheme and icon for walletconnect

* improve walletconnect implementation

* automatically submit when wallet is connected

* Adjust gas price by a percentage (#653)

* create video component

* Feature/show2 290 trending screen (#663)

* wip: trending

* wip: trending

* wip: trending

* wip: trending

* make api fast again

* optimise creator previre

* optimise creator preview

* optimise creator preview

* optimise creator preview

* Update to handle long collection names (#662)

* Enable Magic on minting & marketplace (#665)

* install three.js + upgrade to react 18 + patch packages

* add model component

* Misc fixes (#666)

* spinner fix

* spinner fix

* add swr

* add swr

* add swr

* initial scroll fix

* add accessToken hook (#667)

* fix: added `useAccessToken` to access token for web (#669)

* feat(SHOW2-225): refactor modal component (#652)

* refactor: updated the modal styling for web

* fix: fixed tailwind colors import

* refactor: updated the modal styling for mobile

* chore: reset modal storybook visibility

* refactor: removed index.web

* fix: fixed the modal body styling on mobile

* refactor: updated modal styling for web/ios

* fix: modal gestures components on Android

Co-authored-by: Axel Delafosse <[email protected]>

* list improvements (#671)

* list improvements

* list improvements

* list improvements

* list improvements

* list improvements

* list improvements

* list improvements

* render model as image for now

* mark svg as todo

* mark blurhash as todo on android

* update logo

* add nft title and description components

* clean code

* Update styles and semantics for listed for per feedback (#660)

* disable save changes button when username is not available (#674)

* use suspense + add types + add navigation elements context and hook to hide

* improve collection component

* add send icon

* add comments + message box

* use constants for scroll and padding height

* clean code

* chore(magic): add magic flag in useFlags and import them into modals (#675)

* Profile screen (#677)

* add flipper

* add flipper

* inti

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* enable double tap

* list improvements

* list improvements

* wip profile

* wip profile

* profile api

* profile wip

* profile wip

* profile wip

* profile wip

* profile wip

* profile wip

* profile wip

* wip profile

* wip profile

* wip profile

* wip profile

* wip profile

* wip profile

* profile change route param

* add react navigation to storybook RN

* add react navigation to storybook RN

* add react navigation to storybook RN

* add react navigation to storybook RN

* add camera

* add reanimated handler to pager (#678)

* add reanimated handler to pager

* add reanimated handler to pager

* new tabs

* Revert "new tabs"

This reverts commit b88ae0b.

* upgrade vision-camera

* add create modal

* clean code

* refactor: updated tabs item header width to be dynamic (#681)

* update dependencies

* upgrade deps and revert yarn.lock changes

* use text-13 for tab items

* render svg via xml + disabled press on media if in nft modal

* fix camera tab bar icon container size

* set trending tabs to full width screen

* use suspense for profile tabs

* clean header dropdown

* Show an error when username is too short

* set user color scheme

* update status bar

* fix imports

* Feature/show2 309 create (#688)

* fieldset

* wip create UI

* wip create UI

* wip create UI

* wip create UI

* remove animated view from header (#692)

* use media component everywhere

* use the modal component for the create screen

* fix: color mode re-renders

* fix: color mode re-renders

* fix: color mode re-renders

* feat(SHOW2-283): added login with SMS flow and refactor login styling (#672)

* fix: updated the button height based on design system

* refactor: updated login screen styling

* feat: added keyboard handling for iOS & Android

* refactor: extracted email field ui into a separate component

* feat: added phone number field

* refactor: added contact details and remove email and phone number components

* feat: added loading view

* chore: removed debug console logs

* fix: set loading state on phone number submitting

* refactor: extract root magic instance

* refactor: updated tabs header item indicator positioning

* refactor: added a generic input field

* refactor: extracted login container and header

* refactor: updated login design to follow design system

* fix: prevent tab header from setting invalid height

* refactor: added text content type to input field

* fix: logout customer when app fails to login

* fix(unlist): allow an item to be unlisted by the owner when it not the lowest item for sale (#683)

* Resolve an issue with next.js caching user profiles to a 404 (#680) (#698)

Co-authored-by: Axel Delafosse <[email protected]>

* rework explore page for marketplace (#700)

* rework explore page for marketplace

* fix mobile links

* fix feed button tracking events

Co-authored-by: Axel Delafosse <[email protected]>
Co-authored-by: Nishan <[email protected]>
Co-authored-by: Axel Delafosse <[email protected]>
Co-authored-by: Miguel Piedrafita <[email protected]>
Co-authored-by: Mo Gorhom <[email protected]>
Co-authored-by: Henry Fontanier <[email protected]>
@m1guelpf m1guelpf deleted the feature/show2-326-cant-delete-your-own-listing-if-youre branch January 26, 2022 02:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants