When this parameter is used, is there any easy method for accessing that data or does it required digging in chain logs? Ideally, i’m hoping it is as accessible as checking a balance at an address.
2 Likes
Hi @Garrett_C ,
If you have a look at the _mint
code, it would be up to you how to implement when extending.
* @dev Creates `amount` tokens of token type `id`, and assigns them to `account`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][account] += amount;
emit TransferSingle(operator, address(0), account, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
You could use the _beforeTokenTransfer
hook (https://docs.openzeppelin.com/contracts/3.x/extending-contracts#using-hooks ) to perhaps emit an event, you could then use an offchain service such as The Graph, or use OpenZeppelin Defender Sentinel (https://docs.openzeppelin.com/defender/sentinel ) to then use the data