I've got an ERC1155 contract and I want it to receive an ERC721 token and give other tokens in exchange for that. Can I somehow add ERC721 Receiver interface?
            Asked
            
        
        
            Active
            
        
            Viewed 380 times
        
    1 Answers
1
            
            
        Yes you can do that. It would be best to start looking here at OpenZeppelins documentation on it: https://docs.openzeppelin.com/contracts/2.x/api/token/erc721#IERC721Receiver
In your method that accepts ERC721 tokens, you will need to make sure that the sender approves your contract to transfer tokens on their behalf or else the transaction will fail.
In conjunction with IERC721Receiver you have to use the safeTransferFrom method for this to work properly.
hope this helps.
        Michael
        
- 1,454
 - 3
 - 19
 - 45