Marketplace Boilerplate Smart Contract Question

Hi, could you please briefly explain, why you use address(0) instead of address(this) in createMarketItem, in the Marketplace Smart Contract of your tutorial https://www.youtube.com/watch?v=WZWCzsB1xUE

Best,
John

Can you share the timeframe of the video where I can view address(0)?

Hi, it’s in line 63: https://github.com/ethereum-boilerplate/ethereum-nft-marketplace-boilerplate/blob/main/src/contracts/marketplaceBoilerplate.sol

Following up to that are line 75 and 109 .

It is not elaborated on in the tutorial.

address(0) referrers to the address 0 which is 0x000…000. So in the marketplaceBoilerplate.sol contract address(this) is used at places where a new market item is being created and address(0) to used as there is no previous owner of the MarketItem.

address(this) referrers to the address of the contract. So in the marketplaceBoilerplate.sol contract address(this) is used at places where you want to transfer token from msg.sender to message(this) or vice versa.

Hi, thanks isn’t there always a previous owner of the marketItem, as the wallet, which lists / owns the item is the owner?

I do not have a complete answer for this one.

I see it like this.
The marketplace contract does not know or cannot verify the ownership of the NFT when it is listed and you need to verify the ownership of the nft through a different method through your backend.
Maybe this could be the reason for considering the address(0) as a starting point of this MarketItem event.

There can be someother reason which I am not aware of.