Reputation: 125
I have successfully deployed and verified an ERC721 smart contract on BSC's testnet. Also successfully minted and awarded new ERC721 tokens. Next up is transferring tokens between wallets. So far so good, except that I'd like to add transfer comments to the transfer transactions.
My contract supports the standard safeTransferFrom(senderWaller, receiverWallet, tokenId, data) function, and I can see the data (i.e. - the transfer comment) being sent out. But it doesn't appear when I view the successful transaction in the BSC testnet explorer.
Here is an example transaction --> https://testnet.bscscan.com/tx/0x1f3bf69da66cff66bbeeb6ce6f7505be8a78729685162811cb29c9dc30a347d6. Decoding the data in the BSC testnet explorer I can see the trailing data in hex form and it translates back to readable text when I convert it back. See trailing value starting with 205363... below. Here is a screen shot of the hex converting back to the intended text value.
Function: safeTransferFrom(address from, address to, uint256 tokenId, bytes _data)
MethodID: 0xb88d4fde
[0]: 0000000000000000000000008175f3b00af0b775136b918a78298aaf4e1ea137
[1]: 000000000000000000000000ba3662af7c0cecd20cd97ef8072c30f4449b16b1
[2]: 0000000000000000000000000000000000000000000000000000000000000005
[3]: 0000000000000000000000000000000000000000000000000000000000000080
[4]: 0000000000000000000000000000000000000000000000000000000000000020
[5]: 5363686564756c656420736572766963696e6700000000000000000000000000
Here is my code that is used to encode the web3 method call.
const soygaToken = new web3.eth.Contract(soygaABI, contractAddress);
var byteComments = Buffer.from(comments.padEnd(32, "\0"), 'utf-8');
var myData = soygaToken.methods.safeTransferFrom(senderAddress, recipientAddress, tokenId, byteComments).encodeABI();
Any ideas as to what's causing this data to be missing from the transaction when I look on the BSC testnet explorer? Reviewing the ERC721 specs (https://ethereum.org/en/developers/docs/standards/tokens/erc-721/) the data parameter should be a 32-byte value. Which it appears I'm passing along.
Upvotes: 0
Views: 857
Reputation: 125
Bounced this off the core Nethereum developer. He verified the user data is present, but it's likely just an issue where the Etherscan web client isn't decoding it. So the user data should be accessible.
Upvotes: 0