Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(licensing): add maxRevenueShare parameter to align with core protocol changes #145

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contracts/lib/LicensingHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ library LicensingHelper {
licenseTemplate: derivData.licenseTemplate,
royaltyContext: derivData.royaltyContext,
maxMintingFee: derivData.maxMintingFee,
maxRts: derivData.maxRts
maxRts: derivData.maxRts,
maxRevenueShare: derivData.maxRevenueShare
});
}

Expand Down
2 changes: 2 additions & 0 deletions contracts/lib/WorkflowStructs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ library WorkflowStructs {
/// @param royaltyContext The context for royalty module, should be empty for Royalty Policy LAP.
/// @param maxMintingFee The maximum minting fee that the caller is willing to pay. if set to 0 then no limit.
/// @param maxRts The maximum number of royalty tokens that can be distributed to the external royalty policies.
/// @param maxRevenueShare The maximum revenue share percentage allowed for minting the License Tokens.
struct MakeDerivative {
address[] parentIpIds;
address licenseTemplate;
uint256[] licenseTermsIds;
bytes royaltyContext;
uint256 maxMintingFee;
uint32 maxRts;
uint32 maxRevenueShare;
}

/// @notice Struct for license data for license attachment on IP registration.
Expand Down
7 changes: 5 additions & 2 deletions contracts/story-nft/BaseStoryNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ abstract contract BaseStoryNFT is IStoryNFT, ERC721URIStorageUpgradeable, Ownabl
/// @param royaltyContext The royalty context, should be empty for Royalty Policy LAP.
/// @param maxMintingFee The maximum minting fee that the caller is willing to pay. if set to 0 then no limit.
/// @param maxRts The maximum number of royalty tokens that can be distributed to the external royalty policies.
/// @param maxRevenueShare The maximum revenue share percentage allowed for minting the License Tokens.
function _makeDerivative(
address ipId,
address[] memory parentIpIds,
address licenseTemplate,
uint256[] memory licenseTermsIds,
bytes memory royaltyContext,
uint256 maxMintingFee,
uint32 maxRts
uint32 maxRts,
uint32 maxRevenueShare
) internal virtual {
LICENSING_MODULE.registerDerivative({
childIpId: ipId,
Expand All @@ -141,7 +143,8 @@ abstract contract BaseStoryNFT is IStoryNFT, ERC721URIStorageUpgradeable, Ownabl
licenseTemplate: licenseTemplate,
royaltyContext: royaltyContext,
maxMintingFee: maxMintingFee,
maxRts: maxRts
maxRts: maxRts,
maxRevenueShare: maxRevenueShare
});
}

Expand Down
3 changes: 2 additions & 1 deletion contracts/story-nft/OrgNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ contract OrgNFT is IOrgNFT, ERC721URIStorageUpgradeable, AccessManagedUpgradeabl
licenseTemplate: LICENSE_TEMPLATE,
royaltyContext: "",
maxMintingFee: 0,
maxRts: 0
maxRts: 0,
maxRevenueShare: 0
});

_safeTransfer(address(this), recipient, orgTokenId);
Expand Down
2 changes: 1 addition & 1 deletion contracts/story-nft/StoryBadgeNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ contract StoryBadgeNFT is IStoryBadgeNFT, BaseOrgStoryNFT, CachableNFT, ERC721Ho
licenseTermsIds[0] = DEFAULT_LICENSE_TERMS_ID;

// Make the badge a derivative of the organization IP
_makeDerivative(ipId, parentIpIds, PIL_TEMPLATE, licenseTermsIds, "", 0, 0);
_makeDerivative(ipId, parentIpIds, PIL_TEMPLATE, licenseTermsIds, "", 0, 0, 0);
}

/// @notice Transfers an NFT from one address to another.
Expand Down
7 changes: 5 additions & 2 deletions contracts/workflows/GroupingWorkflows.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.26;
// solhint-disable-next-line max-line-length
import { AccessManagedUpgradeable } from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import { ERC721Holder } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import { MulticallUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol";
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

Expand All @@ -30,7 +31,8 @@ contract GroupingWorkflows is
BaseWorkflow,
MulticallUpgradeable,
AccessManagedUpgradeable,
UUPSUpgradeable
UUPSUpgradeable,
ERC721Holder
{
using ERC165Checker for address;

Expand Down Expand Up @@ -292,7 +294,8 @@ contract GroupingWorkflows is
amount: 1,
receiver: msg.sender,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion contracts/workflows/RoyaltyTokenDistributionWorkflows.sol
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ contract RoyaltyTokenDistributionWorkflows is
amount: 1,
receiver: msg.sender,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});

// set the licensing configuration to disable the temporary license
Expand Down
1 change: 1 addition & 0 deletions script/utils/DeployHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ contract DeployHelper is
impl = address(0); // Make sure we don't deploy wrong impl
impl = address(
new LicenseRegistry(
address(ipAssetRegistry),
_getDeployedAddress(type(LicensingModule).name),
_getDeployedAddress(type(DisputeModule).name),
address(ipGraphACL)
Expand Down
6 changes: 4 additions & 2 deletions test/hooks/LockLicenseHook.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ contract LockLicenseHookTest is BaseTest {
amount: 1,
receiver: u.bob,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});
}

Expand Down Expand Up @@ -101,7 +102,8 @@ contract LockLicenseHookTest is BaseTest {
licenseTemplate: address(pilTemplate),
royaltyContext: "",
maxMintingFee: 0,
maxRts: 0 // non-commercial remixing does not require royalty tokens
maxRts: 0, // non-commercial remixing does not require royalty tokens
maxRevenueShare: 0
});
}

Expand Down
18 changes: 12 additions & 6 deletions test/hooks/TotalLicenseTokenLimitHook.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
amount: 10,
receiver: u.alice,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});
licensingModule.mintLicenseTokens({
licensorIpId: ipId2,
Expand All @@ -88,7 +89,8 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
amount: 20,
receiver: u.alice,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});
licensingModule.mintLicenseTokens({
licensorIpId: ipId3,
Expand All @@ -97,7 +99,8 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
amount: 10,
receiver: u.alice,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});

vm.expectRevert(
Expand All @@ -115,7 +118,8 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
amount: 5,
receiver: u.alice,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});

vm.expectRevert(
Expand All @@ -133,7 +137,8 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
amount: 5,
receiver: u.alice,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});
}

Expand Down Expand Up @@ -212,7 +217,8 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
amount: 10,
receiver: u.alice,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});

vm.expectRevert(
Expand Down
15 changes: 10 additions & 5 deletions test/integration/workflows/DerivativeIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ contract DerivativeIntegration is BaseIntegration {
licenseTermsIds: parentLicenseTermIds,
royaltyContext: "",
maxMintingFee: 0,
maxRts: revShare
maxRts: revShare,
maxRevenueShare: 0
}),
ipMetadata: testIpMetadata,
recipient: testSender,
Expand Down Expand Up @@ -130,7 +131,8 @@ contract DerivativeIntegration is BaseIntegration {
licenseTermsIds: parentLicenseTermIds,
royaltyContext: "",
maxMintingFee: 0,
maxRts: revShare
maxRts: revShare,
maxRevenueShare: 0
}),
ipMetadata: testIpMetadata,
sigMetadata: WorkflowStructs.SignatureData({
Expand Down Expand Up @@ -177,7 +179,8 @@ contract DerivativeIntegration is BaseIntegration {
amount: 1,
receiver: testSender,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});

// Need so that derivative workflows can transfer the license tokens
Expand Down Expand Up @@ -244,7 +247,8 @@ contract DerivativeIntegration is BaseIntegration {
amount: 1,
receiver: testSender,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});

uint256[] memory licenseTokenIds = new uint256[](1);
Expand Down Expand Up @@ -329,7 +333,8 @@ contract DerivativeIntegration is BaseIntegration {
licenseTermsIds: parentLicenseTermIds,
royaltyContext: "",
maxMintingFee: 0,
maxRts: revShare
maxRts: revShare,
maxRevenueShare: 0
}),
testIpMetadata,
testSender
Expand Down
6 changes: 4 additions & 2 deletions test/integration/workflows/GroupingIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ contract GroupingIntegration is BaseIntegration {
licenseTemplate: testLicensesData[0].licenseTemplate,
royaltyContext: "",
maxMintingFee: 0,
maxRts: revShare
maxRts: revShare,
maxRevenueShare: 0
}),
ipMetadata: testIpMetadata,
recipient: testSender,
Expand All @@ -250,7 +251,8 @@ contract GroupingIntegration is BaseIntegration {
licenseTemplate: testLicensesData[0].licenseTemplate,
royaltyContext: "",
maxMintingFee: 0,
maxRts: revShare
maxRts: revShare,
maxRevenueShare: 0
}),
ipMetadata: testIpMetadata,
recipient: testSender,
Expand Down
18 changes: 12 additions & 6 deletions test/integration/workflows/RoyaltyIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ contract RoyaltyIntegration is BaseIntegration {
licenseTermsIds: licenseTermsIds,
royaltyContext: "",
maxMintingFee: 0,
maxRts: defaultCommRevShareA
maxRts: defaultCommRevShareA,
maxRevenueShare: 0
}),
ipMetadata: emptyIpMetadata,
sigMetadata: emptySigData,
Expand Down Expand Up @@ -285,7 +286,8 @@ contract RoyaltyIntegration is BaseIntegration {
licenseTermsIds: licenseTermsIds,
royaltyContext: "",
maxMintingFee: 0,
maxRts: defaultCommRevShareA
maxRts: defaultCommRevShareA,
maxRevenueShare: 0
}),
ipMetadata: emptyIpMetadata,
sigMetadata: emptySigData,
Expand Down Expand Up @@ -326,7 +328,8 @@ contract RoyaltyIntegration is BaseIntegration {
licenseTermsIds: licenseTermsIds,
royaltyContext: "",
maxMintingFee: 0,
maxRts: defaultCommRevShareC
maxRts: defaultCommRevShareC,
maxRevenueShare: 0
}),
ipMetadata: emptyIpMetadata,
sigMetadata: emptySigData,
Expand Down Expand Up @@ -370,7 +373,8 @@ contract RoyaltyIntegration is BaseIntegration {
licenseTermsIds: licenseTermsIds,
royaltyContext: "",
maxMintingFee: 0,
maxRts: uint32(defaultCommRevShareA * parentIpIds.length)
maxRts: uint32(defaultCommRevShareA * parentIpIds.length),
maxRevenueShare: 0
}),
ipMetadata: emptyIpMetadata,
sigMetadata: emptySigData,
Expand All @@ -396,7 +400,8 @@ contract RoyaltyIntegration is BaseIntegration {
amount: amountLicenseTokensToMint,
receiver: testSender,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});

// mint `amountLicenseTokensToMint` childIpC's license tokens
Expand All @@ -407,7 +412,8 @@ contract RoyaltyIntegration is BaseIntegration {
amount: amountLicenseTokensToMint,
receiver: testSender,
royaltyContext: "",
maxMintingFee: 0
maxMintingFee: 0,
maxRevenueShare: 0
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/modules/tokenizer/TokenizerModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ contract TokenizerModuleTest is BaseTest {
licenseTermsIds: licenseIds,
royaltyContext: "",
maxMintingFee: 0,
maxRts: 0
maxRts: 0,
maxRevenueShare: 0
}),
recipient: u.alice,
ipMetadata: ipMetadataDefault,
Expand Down
Loading
Loading