Skip to content

Commit

Permalink
use _safeMint() for Minting Group NFTs (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingster-will authored Dec 12, 2024
1 parent b4af15c commit fe111b6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts/GroupNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ contract GroupNFT is IGroupNFT, ERC721Upgradeable, AccessManagedUpgradeable, UUP
function mintGroupNft(address minter, address receiver) external onlyGroupingModule returns (uint256 groupNftId) {
GroupNFTStorage storage $ = _getGroupNFTStorage();
groupNftId = $.totalSupply++;
_mint(receiver, groupNftId);
_safeMint(receiver, groupNftId);
emit GroupNFTMinted(minter, receiver, groupNftId);
}

Expand Down
3 changes: 2 additions & 1 deletion test/foundry/modules/grouping/EvenSplitGroupPool.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.8.26;

// external
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { ERC721Holder } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";

// contracts
import { PILFlavors } from "../../../../contracts/lib/PILFlavors.sol";
Expand All @@ -12,7 +13,7 @@ import { MockERC721 } from "../../mocks/token/MockERC721.sol";
import { BaseTest } from "../../utils/BaseTest.t.sol";
import { Errors } from "../../../../contracts/lib/Errors.sol";

contract EvenSplitGroupPoolTest is BaseTest {
contract EvenSplitGroupPoolTest is BaseTest, ERC721Holder {
using Strings for *;

MockERC721 internal mockNft = new MockERC721("MockERC721");
Expand Down
3 changes: 2 additions & 1 deletion test/foundry/modules/royalty/IpRoyaltyVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.8.26;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ERC721Holder } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";

// contracts
import { IpRoyaltyVault } from "../../../../contracts/modules/royalty/policies/IpRoyaltyVault.sol";
Expand All @@ -13,7 +14,7 @@ import { Errors } from "../../../../contracts/lib/Errors.sol";
// tests
import { BaseTest } from "../../utils/BaseTest.t.sol";

contract TestIpRoyaltyVault is BaseTest {
contract TestIpRoyaltyVault is BaseTest, ERC721Holder {
function setUp() public override {
super.setUp();

Expand Down
5 changes: 3 additions & 2 deletions test/foundry/modules/royalty/RoyaltyModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.26;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ERC6551AccountLib } from "erc6551/lib/ERC6551AccountLib.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import { ERC721Holder } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";

// contracts
import { Errors } from "../../../../contracts/lib/Errors.sol";
Expand All @@ -18,7 +19,7 @@ import { MockExternalRoyaltyPolicy2 } from "../../mocks/policy/MockExternalRoyal
import { MockERC721 } from "../../mocks/token/MockERC721.sol";
import { EvenSplitGroupPool } from "../../../../contracts/modules/grouping/EvenSplitGroupPool.sol";

contract TestRoyaltyModule is BaseTest {
contract TestRoyaltyModule is BaseTest, ERC721Holder {
event RoyaltyPolicyWhitelistUpdated(address royaltyPolicy, bool allowed);
event RoyaltyTokenWhitelistUpdated(address token, bool allowed);
event RoyaltyPolicySet(address ipId, address royaltyPolicy, bytes data);
Expand Down Expand Up @@ -816,12 +817,12 @@ contract TestRoyaltyModule is BaseTest {
parentRoyalties[1] = uint32(17 * 10 ** 6);
parentRoyalties[2] = uint32(24 * 10 ** 6);

vm.startPrank(address(licensingModule));
address groupId = groupingModule.registerGroup(address(rewardPool));
ipGraph.addParentIp(groupId, parents);

assertEq(royaltyModule.ipRoyaltyVaults(groupId), address(0));

vm.startPrank(address(licensingModule));
royaltyModule.onLinkToParents(groupId, parents, licenseRoyaltyPolicies, parentRoyalties, "", 100e6);

address ipRoyaltyVault80 = royaltyModule.ipRoyaltyVaults(groupId);
Expand Down

0 comments on commit fe111b6

Please sign in to comment.