CRYPTO NEWS

ERC-721 safeTransferFrom() not working when sending an NFT from a regular address to a smart contract address

I’m testing transferring a minted NFT from a regular address to this smart contract’s address (I’m creating a DEX), but whenever I test it with Truffle I get the error VM Exception while processing transaction: revert.

contract Exchange is ERC721Enumerable {     function sellToExchange(uint256 _tokenId, uint256 _sellPrice) public {        safeTransferFrom(msg.sender, payable(this), _tokenId);     } } 

I don’t understand why I keep getting this error. If I call the exact same function with transferFrom() instead, it passes my test, but not with safeTransferFrom().

I’m using OpenZeppelin’s ERC721 contract by the way.

Also, should I make the smart contract’s address a type of address or address payable in order to receive the NFT?

ANSWER:

The issue was that in order to receive NFT/ERC721 tokens to a smart contract address, that address needs to inherit ERC721Holder.sol which is found on OpenZeppelin’s contract GitHub repo (link below).

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/utils/ERC721Holder.sol

Can you rely on the permutation of a ciphertext for secrecy?

Say you have a message and you run it through an all-or-nothing transform. A transform that requires every single block in the correct order in order to recover any data. Each block is indistinguishable from random noise. Now shuffle them using a seeded crypto RNG. Say the transform gives you at least 34 blocks (which::Listen

Say you have a message and you run it through an all-or-nothing transform. A transform that requires every single block in the correct order in order to recover any data. Each block is indistinguishable from random noise. Now shuffle them using a seeded crypto RNG.

Say the transform gives you at least 34 blocks (which can be arranged in ~2^128 permutations). Can this structure be considered safe? There’s no actual key involved, unless you count the RNG seed.

ERC-721 safeTransferFrom() not working when sending an NFT from a regular address to a smart contract address

Shopping cart
There are no products in the cart!
Continue shopping
0