// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import "forge-std/Test.sol"; import "forge-std/console2.sol"; import "#/extension/ThirdPartyMint1155.sol"; import "#/KanjiThirdParty.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; contract ExampleContract is ThirdPartyMint1155, ERC1155 { constructor(IAccessControl _thirdParty) ERC1155("TEST") ThirdPartyMint1155(_thirdParty) {} function _afterMintFromThirdParty(address _receiver, uint256 _tokenId, uint256 _quantity) internal override { _mint(_receiver, _tokenId, _quantity, ""); } function _beforeChangeThirdPartySetup(IAccessControl) internal view override { console.log("before change third party"); } } contract ThirdPartyMint1155Test is Test { ExampleContract c; IAccessControl public thirdParty; address public constant BOB = 0x0000000000000000000000000000000000010002; function setUp() public { thirdParty = new KanjiThirdParty(BOB); c = new ExampleContract(thirdParty); } function testCannotMintFromThirdPartyIfMsgSenderIsNotThirdPartyError() public { vm.expectRevert(abi.encodeWithSignature("CannotMintFromThirdPartyIfMsgSenderIsNotMinterError()")); c.mintFromThirdParty(BOB, 1, 1); } function testThirdPartyMint() public { vm.prank(BOB); c.mintFromThirdParty(BOB, 1, 1); } }