Skip to content

Commit

Permalink
Mint without verification data should not make an external call
Browse files Browse the repository at this point in the history
  • Loading branch information
matejos committed Apr 2, 2024
1 parent 5e6b1ba commit 8f19172
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract InverseAppProjectedNft is IInverseAppProjectedNft, ERC721, Ownable {
/// Increases the `totalSupply` and `currentTokenId`.
/// Reverts if `_to` is a zero address or if it refers to smart contract but does not implement IERC721Receiver-onERC721Received.
/// Emits the `Minted` event.
function mint(address _to, bytes calldata _verificationData) public virtual returns (uint256) {
function mint(address _to, bytes memory _verificationData) public virtual returns (uint256) {
require(_to != address(0), "InverseAppProjectedNft: zero receiver address");
require(
validateMint(_to, _verificationData),
Expand All @@ -96,7 +96,7 @@ contract InverseAppProjectedNft is IInverseAppProjectedNft, ERC721, Ownable {
}

function mint(address _to) external returns (uint256) {
return this.mint(_to, "");
return mint(_to, bytes(""));
}

/// @dev Burns token of ID `_tokenId`. Callable only by the owner of the specified token.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ contract InverseAppProjectedNftTest is CTest, ERC721Holder {
}

function test_CanMint() public {
vm.prank(alice);
vm.expectEmit(true, true, true, true);
emit IInverseAppProjectedNft.Minted(2, address(this), 2);
nft.mint(address(this), bytes(""));
}

function test_CanMintNoVerificationData() public {
vm.prank(alice);
vm.expectEmit(true, true, true, true);
emit IInverseAppProjectedNft.Minted(2, address(this), 2);
Expand Down

0 comments on commit 8f19172

Please sign in to comment.