onflow / nft-storefront

A general-purpose Cadence contract for trading NFTs on Flow
The Unlicense
102 stars 53 forks source link

How do I know what listings i am able to fulfill #50

Closed bjartek closed 2 years ago

bjartek commented 2 years ago

As a marketplace owner for v2 storefront, how can i fetch information about what listings i can fulfill or not?

The list of addresses that can fulfill an listing is not exposed and there is not method to check if I am allowed to do so or not.

satyamakgec commented 2 years ago

As a marketplace owner for v2 storefront, how can i fetch information about what listings i can fulfill or not?

The list of addresses that can fulfill an listing is not exposed and there is not method to check if I am allowed to do so or not.

If I understand correctly what you wanna say here - Is how does the marketplace know which listing it should facilitate? If yes then during the creation of the listing marketplace can pass an identifier so they can easily filter those listings that they created and show them on their UI and other listings (those are not created from their platform) they can facilitate if they wanna earn sweet commission and keep an eye which listing offering the commission and whether there address is listed init or not.

Does my interpretation of your question right?

bjartek commented 2 years ago

Let say that .find in our NFT detail page want to know what listings we can fulfill or not. From my understanding it is impossible to do this using the listing resource on chain. I can check if the given NFT for the given user has a listing, but there is no way for me to know if I can fulfill it or not, or if I cannot to link to the origin site where it can be fulfilled.

bluesign commented 2 years ago

it is not possible, you need to access : https://github.com/onflow/nft-storefront/blob/6a3982ebc55d053542c25cdf98780e4450a2bb95/contracts/NFTStorefrontV2.cdc#L261

Basically it is a problem with Cadence actually, when you have hammer ( access(contract) ), everything seems like nail

bjartek commented 2 years ago

I think it would be useful if a marketplace wants to use this limitation to create private sales that they should also provide a link to where this sale item can be fulfilled.

albeethekid commented 2 years ago

@satyamakgec to clarify, for listings that make use of "an optional list of marketplace receiver capabilities. In this case, the commission amount must be transferred to one of the capabilities in the list..." We should consider exposing something in the listing event, perhaps a flag, to allow the community to know if, or if not, they are able to capture the commission on a given listing, at a glance (we should avoid having to run a script to check every listing) @bjartek did I capture the issue you raised here? Do you have any thoughts for how we could address this?

satyamakgec commented 2 years ago

oh! so as a marketplace, I want to know whether I can facilitate the listing or not and get the commission out of it.

That makes sense, I think it is best to make a public function that will allow accessing the supported marketplaces and also emit the addresses of the marketplaces (can't do capability - cadence doesn't support) when the listing got available in the NFT storefront.

@bjartek @bluesign WDYT?

bluesign commented 2 years ago

@satyamakgec, I think some business logic I am missing.

I don't know if there are any storyboards for StoreFront, but this didn't add up for me, what is the use case here?

For example bloctoBay on listing will add Viv3 ? Or TopShot marketplace will add bloctobay there?

PS: I think @bjartek will explain better, but his issue was about to access to capabilities probably, instead of listening via event.

satyamakgec commented 2 years ago

@satyamakgec, I think some business logic I am missing.

  • an optional list of marketplace receiver capabilities.

I don't know if there are any storyboards for StoreFront, but this didn't add up for me, what is the use case here?

For example bloctoBay on listing will add Viv3 ? Or TopShot marketplace will add bloctobay there?

PS: I think @bjartek will explain better, but his issue was about to access to capabilities probably, instead of listening via event.

Okay so filling up the context of that change here -

Initially, NFTStorefront contract was designed in such a way that a seller has to create multiple listings if it wants to support the listing to multiple marketplaces because saleCut should know the capability beforehand and there was no or logic in the saleCuts so the seller can make a relationship such that one part of sale cut will be provided to X or Y or Z capabilities of the marketplaces so seller was forced to create multiple listing of one NFT to support multiple marketplaces.

To resolve this we introduced the concept of commission for the facilitator(It can be marketplace or any individual address) of the purchase, Even the purchaser can provide its own capability as the facilitator and get a sweet discount on the purchase. This design wasn't hurting the seller as anyway they have to provide the sell cut to the marketplace, so they don't mind providing it to the purchaser or someone but it had an adverse effect on the marketplaces as there would not be a guarantee of the commission if they list it as it is open for anyone to grab. So we introduced a tweak in the process by introducing the optional marketplaces capabilities that sellers can provide during the creation of the listing and because of that only listed marketplaces can take the commission of the sale (Not open to anyone), While if provided marketplaces capabilities are nil then the commission is open to everyone to grab.

We are thinking to create a GitHub repo which will keep the list of the "ACTIVE" marketplace capabilities that any dapp can use to support the creation of the listing. Marketplaces have to keep their latest active capabilities in that repo.

bluesign commented 2 years ago

Yeah this is very tricky, marketplaces would like to keep their inventory. ( or they die )

Not sure if any sane marketplace would like to share.

albeethekid commented 2 years ago

Marketplaces could make use of saleCuts to ensure they are paid. It seems to me that the reason to use the marketplacesCapabilitiy is in case the commission is abused. The idea initially was that Dapps, not marketplaces, would use the commission as a way to entice marketplaces to list an item for sale. And in that case, it might make sense to limit the ability of capturing a commission to a list of known marketplaces.