CRYPTO NEWS

Crypto’s uses and misuses: Binance–Reuters quarrel raises questions

Does the struggle between Binance and Reuters, both heavyweights in their respective industries, have broader implications for the crypto sector?

ERC721 How to set TokenUri from mint function argument

I use pragma solidity ^0.8.0; and contract MyERC721 is Ownable, ERC721URIStorage I want to set the tokenUri from my mint function argument like this: function mintToken(address recipient, string memory tokenURI) external onlyOwner { uint256 newItemId = _tokenIds.current(); _safeMint(recipient, _tokenIds.current()); _setTokenURI(newItemId, tokenURI); _tokenIds.increment(); } On https://rinkeby.etherscan.io/address/0x89…80b#writeContract I trigger mintToken with an transfer address and the ipfs::Listen

I use pragma solidity ^0.8.0; and contract MyERC721 is Ownable, ERC721URIStorage

I want to set the tokenUri from my mint function argument like this:

function mintToken(address recipient, string memory tokenURI) external onlyOwner {         uint256 newItemId = _tokenIds.current();         _safeMint(recipient, _tokenIds.current());         _setTokenURI(newItemId, tokenURI);         _tokenIds.increment();     } 

On https://rinkeby.etherscan.io/address/0x89…80b#writeContract I trigger mintToken with an transfer address and the ipfs url "ipfs://bafk…eu"

On OpenSea the preview image is broken and the token id is not linked with the tokenUrl

But when I set the tokenUri inside of the mint function like this

function mintToken(address recipient) external onlyOwner {         uint256 newItemId = _tokenIds.current();         _safeMint(recipient, _tokenIds.current());         _setTokenURI(newItemId, "ipfs://bafk...eu");         _tokenIds.increment();     } 

Suddenly everything is fine. OpenSea displays the preview image and links the token id with the tokenUri

Whats the difference between the two ways and why is way 1 not working?

Also when I call tokenURI on https://rinkeby.etherscan.io/address/0x89…80b#readContract for both contracts, both minted tokens return the same url "ipfs://bafk…eu". That’s strange.

Crypto’s uses and misuses: Binance–Reuters quarrel raises questions

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