Skip to content

Commit

Permalink
fix: calc minting fee returns 0
Browse files Browse the repository at this point in the history
  • Loading branch information
sebsadface committed Oct 19, 2024
1 parent 610040d commit d9620bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions contracts/hooks/LockLicenseHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ contract LockLicenseHook is BaseModule, ILicensingHook {
}

/// @notice This function is called when the LicensingModule calculates/predict the minting fee for license tokens.
/// @dev This function will always revert to prevent any license minting fee calculation/prediction.
/// @dev This function will always return 0 to signal that license is locked/disabled.
/// @param caller The address of the caller who calling the mintLicenseTokens() function.
/// @param licensorIpId The ID of licensor IP from which issue the license tokens.
/// @param licenseTemplate The address of the license template.
Expand All @@ -77,7 +77,7 @@ contract LockLicenseHook is BaseModule, ILicensingHook {
address receiver,
bytes calldata hookData
) external view returns (uint256 totalMintingFee) {
revert LockLicenseHook_LicenseLocked(licensorIpId, licenseTemplate, licenseTermsId);
totalMintingFee = 0;
}

function supportsInterface(bytes4 interfaceId) public view virtual override(BaseModule, IERC165) returns (bool) {
Expand Down
15 changes: 4 additions & 11 deletions test/hooks/LockLicenseHook.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ contract LockLicenseHookTest is BaseTest {
});
}

function test_LockLicenseHook_revert_calculateMintingFee() public {
function test_LockLicenseHook_calculateMintingFee() public {
uint256 socialRemixTermsId = pilTemplate.registerLicenseTerms(PILFlavors.nonCommercialSocialRemixing());
LockLicenseHook lockLicenseHook = new LockLicenseHook();
vm.prank(u.admin);
Expand All @@ -107,7 +107,7 @@ contract LockLicenseHookTest is BaseTest {
vm.startPrank(ipOwner);
Licensing.LicensingConfig memory licensingConfig = Licensing.LicensingConfig({
isSet: true,
mintingFee: 0,
mintingFee: 1000,
licensingHook: address(lockLicenseHook),
hookData: "",
commercialRevShare: 0
Expand All @@ -116,21 +116,14 @@ contract LockLicenseHookTest is BaseTest {
vm.stopPrank();

vm.startPrank(u.bob);
vm.expectRevert(
abi.encodeWithSelector(
LockLicenseHook.LockLicenseHook_LicenseLocked.selector,
ipId,
address(pilTemplate),
socialRemixTermsId
)
);
licensingModule.predictMintingLicenseFee({
(, uint256 mintingFee) = licensingModule.predictMintingLicenseFee({
licensorIpId: ipId,
licenseTemplate: address(pilTemplate),
licenseTermsId: socialRemixTermsId,
amount: 1,
receiver: u.bob,
royaltyContext: ""
});
assertEq(mintingFee, 0);
}
}

0 comments on commit d9620bf

Please sign in to comment.