I want to share my pain, guys I learn Solidity and found that there are no normal interface validations. I am not sure of how to really interact with external contracts without importing them beforehand. Let's say the user creates the NFT and wants to sell it on the marketplace. As a marketplace, I have no idea about the user contract and understand that this contract really implements ERC721/1155 standard. Also, I cannot import the user's contract beforehand. Moreover, it can be a lot of different contracts, so I have to interact with them dynamically. How do you guys solve this problem? Or maybe I missed something? Thanks! I know how interface validation works for PHP, JAVA but cannot see anything similar here
Asked
Active
Viewed 18 times
0
-
I'm not sure I understand. You use interfaces to introduce the functionality you want to access in another contract - assuming that the other contract supports such functionality. – Lauri Peltonen Jan 25 '22 at 12:26
-
All our imported contracts should be imported as a hardcore inside the file, i.e. import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; But what if we do not know the contract yet? Is it possible to import it dynamically? – user17732087 Jan 25 '22 at 13:10
-
I am a marketplace and users can upload NFT to sell, so I have to interact with a user contract somehow. But I do not know anything about the contract yet. Also, I have to know that this contract implements ERC721/1155 How this mechanism can be applied? – user17732087 Jan 25 '22 at 13:21
-
If you know the functionality you want to call in another contract, you can write an interface for it. There is no certain way to know whether some contract follows certain standard or not. – Lauri Peltonen Jan 25 '22 at 14:43