Skip to content

Commit

Permalink
rename PILTermsData -> LicenseTermsData
Browse files Browse the repository at this point in the history
  • Loading branch information
sebsadface committed Nov 30, 2024
1 parent 00b13ea commit 151b15d
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 69 deletions.
12 changes: 6 additions & 6 deletions contracts/interfaces/workflows/ILicenseAttachmentWorkflows.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { WorkflowStructs } from "../../lib/WorkflowStructs.sol";
interface ILicenseAttachmentWorkflows {
/// @notice Register Programmable IP License Terms (if unregistered) and attach it to IP.
/// @param ipId The ID of the IP.
/// @param pilTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param sigAttachAndConfig Signature data for attachLicenseTerms and setLicensingConfig to the IP via the Licensing Module.
/// @return licenseTermsIds The IDs of the newly registered PIL terms.
function registerPILTermsAndAttach(
address ipId,
WorkflowStructs.PILTermsData[] calldata pilTermsData,
WorkflowStructs.LicenseTermsData[] calldata licenseTermsData,
WorkflowStructs.SignatureData calldata sigAttachAndConfig
) external returns (uint256[] memory licenseTermsIds);

Expand All @@ -23,7 +23,7 @@ interface ILicenseAttachmentWorkflows {
/// @param spgNftContract The address of the SPGNFT collection.
/// @param recipient The address of the recipient of the minted NFT.
/// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP.
/// @param pilTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param allowDuplicates Set to true to allow minting an NFT with a duplicate metadata hash.
/// @return ipId The ID of the newly registered IP.
/// @return tokenId The ID of the newly minted NFT.
Expand All @@ -32,7 +32,7 @@ interface ILicenseAttachmentWorkflows {
address spgNftContract,
address recipient,
WorkflowStructs.IPMetadata calldata ipMetadata,
WorkflowStructs.PILTermsData[] calldata pilTermsData,
WorkflowStructs.LicenseTermsData[] calldata licenseTermsData,
bool allowDuplicates
) external returns (address ipId, uint256 tokenId, uint256[] memory licenseTermsIds);

Expand All @@ -42,7 +42,7 @@ interface ILicenseAttachmentWorkflows {
/// @param nftContract The address of the NFT collection.
/// @param tokenId The ID of the NFT.
/// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP.
/// @param pilTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param sigMetadataAndAttachAndConfig Signature data for setAll (metadata), attachLicenseTerms, and
/// setLicensingConfig to the IP via the Core Metadata Module and Licensing Module.
/// @return ipId The ID of the newly registered IP.
Expand All @@ -51,7 +51,7 @@ interface ILicenseAttachmentWorkflows {
address nftContract,
uint256 tokenId,
WorkflowStructs.IPMetadata calldata ipMetadata,
WorkflowStructs.PILTermsData[] calldata pilTermsData,
WorkflowStructs.LicenseTermsData[] calldata licenseTermsData,
WorkflowStructs.SignatureData calldata sigMetadataAndAttachAndConfig
) external returns (address ipId, uint256[] memory licenseTermsIds);
}
8 changes: 4 additions & 4 deletions contracts/lib/LicensingHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ library LicensingHelper {
/// @param ipId The ID of the IP.
/// @param pilTemplate The address of the PIL License Template.
/// @param licensingModule The address of the Licensing Module.
/// @param pilTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @return licenseTermsId The ID of the registered PIL terms.
function registerPILTermsAndAttachAndSetConfigs(
address ipId,
address pilTemplate,
address licensingModule,
WorkflowStructs.PILTermsData memory pilTermsData
WorkflowStructs.LicenseTermsData memory licenseTermsData
) internal returns (uint256 licenseTermsId) {
licenseTermsId = IPILicenseTemplate(pilTemplate).registerLicenseTerms(pilTermsData.terms);
licenseTermsId = IPILicenseTemplate(pilTemplate).registerLicenseTerms(licenseTermsData.terms);
attachLicenseTermsAndSetConfigs(
ipId,
licensingModule,
pilTemplate,
licenseTermsId,
pilTermsData.licensingConfig
licenseTermsData.licensingConfig
);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/WorkflowStructs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ library WorkflowStructs {
/// @notice Struct for PIL terms data for PIL registration and attachment on IP registration.
/// @param terms The PIL terms to be used for the licensing.
/// @param licenseTermsConfig The licensing configuration for the PIL terms.
struct PILTermsData {
struct LicenseTermsData {
PILTerms terms;
Licensing.LicensingConfig licensingConfig;
}
Expand Down
28 changes: 14 additions & 14 deletions contracts/workflows/LicenseAttachmentWorkflows.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ contract LicenseAttachmentWorkflows is

/// @notice Register Programmable IP License Terms (if unregistered) and attach it to IP.
/// @param ipId The ID of the IP.
/// @param pilTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param sigAttachAndConfig Signature data for attachLicenseTerms and setLicensingConfig to the IP via the Licensing Module.
/// @return licenseTermsIds The IDs of the newly registered PIL terms.
function registerPILTermsAndAttach(
address ipId,
WorkflowStructs.PILTermsData[] calldata pilTermsData,
WorkflowStructs.LicenseTermsData[] calldata licenseTermsData,
WorkflowStructs.SignatureData calldata sigAttachAndConfig
) external returns (uint256[] memory licenseTermsIds) {
address[] memory modules = new address[](2);
Expand All @@ -113,7 +113,7 @@ contract LicenseAttachmentWorkflows is
sigData: sigAttachAndConfig
});

licenseTermsIds = _registerMultiplePILTermsAndAttachAndSetConfigs(ipId, pilTermsData);
licenseTermsIds = _registerMultiplePILTermsAndAttachAndSetConfigs(ipId, licenseTermsData);
}

/// @notice Mint an NFT from a SPGNFT collection, register it with metadata as an IP,
Expand All @@ -122,7 +122,7 @@ contract LicenseAttachmentWorkflows is
/// @param spgNftContract The address of the SPGNFT collection.
/// @param recipient The address of the recipient of the minted NFT.
/// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP.
/// @param pilTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param allowDuplicates Set to true to allow minting an NFT with a duplicate metadata hash.
/// @return ipId The ID of the newly registered IP.
/// @return tokenId The ID of the newly minted NFT.
Expand All @@ -131,7 +131,7 @@ contract LicenseAttachmentWorkflows is
address spgNftContract,
address recipient,
WorkflowStructs.IPMetadata calldata ipMetadata,
WorkflowStructs.PILTermsData[] calldata pilTermsData,
WorkflowStructs.LicenseTermsData[] calldata licenseTermsData,
bool allowDuplicates
)
external
Expand All @@ -149,7 +149,7 @@ contract LicenseAttachmentWorkflows is
ipId = IP_ASSET_REGISTRY.register(block.chainid, spgNftContract, tokenId);
MetadataHelper.setMetadata(ipId, address(CORE_METADATA_MODULE), ipMetadata);

licenseTermsIds = _registerMultiplePILTermsAndAttachAndSetConfigs(ipId, pilTermsData);
licenseTermsIds = _registerMultiplePILTermsAndAttachAndSetConfigs(ipId, licenseTermsData);

ISPGNFT(spgNftContract).safeTransferFrom(address(this), recipient, tokenId, "");
}
Expand All @@ -160,7 +160,7 @@ contract LicenseAttachmentWorkflows is
/// @param nftContract The address of the NFT collection.
/// @param tokenId The ID of the NFT.
/// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP.
/// @param pilTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param sigMetadataAndAttachAndConfig Signature data for setAll (metadata), attachLicenseTerms, and
/// setLicensingConfig to the IP via the Core Metadata Module and Licensing Module.
/// @return ipId The ID of the newly registered IP.
Expand All @@ -169,7 +169,7 @@ contract LicenseAttachmentWorkflows is
address nftContract,
uint256 tokenId,
WorkflowStructs.IPMetadata calldata ipMetadata,
WorkflowStructs.PILTermsData[] calldata pilTermsData,
WorkflowStructs.LicenseTermsData[] calldata licenseTermsData,
WorkflowStructs.SignatureData calldata sigMetadataAndAttachAndConfig
) external returns (address ipId, uint256[] memory licenseTermsIds) {
ipId = IP_ASSET_REGISTRY.register(block.chainid, nftContract, tokenId);
Expand All @@ -192,24 +192,24 @@ contract LicenseAttachmentWorkflows is

MetadataHelper.setMetadata(ipId, address(CORE_METADATA_MODULE), ipMetadata);

licenseTermsIds = _registerMultiplePILTermsAndAttachAndSetConfigs(ipId, pilTermsData);
licenseTermsIds = _registerMultiplePILTermsAndAttachAndSetConfigs(ipId, licenseTermsData);
}

/// @notice Registers multiple PIL terms and attaches them to the given IP and sets their licensing configurations.
/// @param ipId The ID of the IP.
/// @param pilTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @param licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
/// @return licenseTermsIds The IDs of the newly registered PIL terms.
function _registerMultiplePILTermsAndAttachAndSetConfigs(
address ipId,
WorkflowStructs.PILTermsData[] calldata pilTermsData
WorkflowStructs.LicenseTermsData[] calldata licenseTermsData
) private returns (uint256[] memory licenseTermsIds) {
licenseTermsIds = new uint256[](pilTermsData.length);
for (uint256 i; i < pilTermsData.length; i++) {
licenseTermsIds = new uint256[](licenseTermsData.length);
for (uint256 i; i < licenseTermsData.length; i++) {
licenseTermsIds[i] = LicensingHelper.registerPILTermsAndAttachAndSetConfigs(
ipId,
address(PIL_TEMPLATE),
address(LICENSING_MODULE),
pilTermsData[i]
licenseTermsData[i]
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/integration/workflows/DerivativeIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract DerivativeIntegration is BaseIntegration {
address[] private parentIpIds;
uint256[] private parentLicenseTermIds;
address private parentLicenseTemplate;
WorkflowStructs.PILTermsData[] internal pilTermsData;
WorkflowStructs.LicenseTermsData[] internal licenseTermsData;
uint32 private revShare;

/// @dev To use, run the following command:
Expand Down Expand Up @@ -385,8 +385,8 @@ contract DerivativeIntegration is BaseIntegration {

revShare = 10 * 10 ** 6; // 10%

pilTermsData.push(
WorkflowStructs.PILTermsData({
licenseTermsData.push(
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.commercialRemix({
mintingFee: testMintFee,
commercialRevShare: revShare,
Expand All @@ -413,7 +413,7 @@ contract DerivativeIntegration is BaseIntegration {
spgNftContract: address(spgNftContract),
recipient: testSender,
ipMetadata: testIpMetadata,
pilTermsData: pilTermsData,
licenseTermsData: licenseTermsData,
allowDuplicates: true
});

Expand Down
18 changes: 9 additions & 9 deletions test/integration/workflows/LicenseAttachmentIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {
using Strings for uint256;

ISPGNFT private spgNftContract;
WorkflowStructs.PILTermsData[] private commTermsData;
WorkflowStructs.LicenseTermsData[] private commTermsData;

/// @dev To use, run the following command:
/// forge script test/integration/workflows/LicenseAttachmentIntegration.t.sol:LicenseAttachmentIntegration \
Expand Down Expand Up @@ -58,7 +58,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {

uint256[] memory licenseTermsIds = licenseAttachmentWorkflows.registerPILTermsAndAttach({
ipId: ipId,
pilTermsData: commTermsData,
licenseTermsData: commTermsData,
sigAttachAndConfig: WorkflowStructs.SignatureData({
signer: testSender,
deadline: deadline,
Expand All @@ -85,7 +85,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {
spgNftContract: address(spgNftContract),
recipient: testSender,
ipMetadata: testIpMetadata,
pilTermsData: commTermsData,
licenseTermsData: commTermsData,
allowDuplicates: true
});
assertTrue(ipAssetRegistry.isRegistered(ipId1));
Expand All @@ -110,7 +110,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {
spgNftContract: address(spgNftContract),
recipient: testSender,
ipMetadata: testIpMetadata,
pilTermsData: commTermsData,
licenseTermsData: commTermsData,
allowDuplicates: true
});
assertTrue(ipAssetRegistry.isRegistered(ipId2));
Expand Down Expand Up @@ -158,7 +158,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {
nftContract: address(spgNftContract),
tokenId: tokenId,
ipMetadata: testIpMetadata,
pilTermsData: commTermsData,
licenseTermsData: commTermsData,
sigMetadataAndAttachAndConfig: WorkflowStructs.SignatureData({
signer: testSender,
deadline: deadline,
Expand Down Expand Up @@ -200,7 +200,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {
);

commTermsData.push(
WorkflowStructs.PILTermsData({
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.commercialUse({
mintingFee: testMintFee,
currencyToken: testMintFeeToken,
Expand All @@ -220,7 +220,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {
);

commTermsData.push(
WorkflowStructs.PILTermsData({
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.commercialUse({
mintingFee: testMintFee,
currencyToken: testMintFeeToken,
Expand All @@ -240,7 +240,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {
);

commTermsData.push(
WorkflowStructs.PILTermsData({
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.commercialRemix({
mintingFee: testMintFee,
commercialRevShare: 5_000_000, // 5%
Expand All @@ -261,7 +261,7 @@ contract LicenseAttachmentIntegration is BaseIntegration {
);

commTermsData.push(
WorkflowStructs.PILTermsData({
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.commercialRemix({
mintingFee: testMintFee,
commercialRevShare: 8_000_000, // 8%
Expand Down
8 changes: 4 additions & 4 deletions test/integration/workflows/RoyaltyIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract RoyaltyIntegration is BaseIntegration {
uint256 internal defaultMintingFeeC = 500 * 10 ** StoryUSD.decimals(); // 500 SUSD
uint32 internal defaultCommRevShareC = 20 * 10 ** 6; // 20%

WorkflowStructs.PILTermsData[] internal commTermsData;
WorkflowStructs.LicenseTermsData[] internal commTermsData;

uint256 internal amountLicenseTokensToMint = 1;

Expand Down Expand Up @@ -212,7 +212,7 @@ contract RoyaltyIntegration is BaseIntegration {

{
commTermsData.push(
WorkflowStructs.PILTermsData({
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.commercialRemix({
mintingFee: defaultMintingFeeA,
commercialRevShare: defaultCommRevShareA,
Expand All @@ -232,7 +232,7 @@ contract RoyaltyIntegration is BaseIntegration {
})
);
commTermsData.push(
WorkflowStructs.PILTermsData({
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.commercialRemix({
mintingFee: defaultMintingFeeC,
commercialRevShare: defaultCommRevShareC,
Expand Down Expand Up @@ -263,7 +263,7 @@ contract RoyaltyIntegration is BaseIntegration {

uint256[] memory licenseTermsIds = licenseAttachmentWorkflows.registerPILTermsAndAttach({
ipId: ancestorIpId,
pilTermsData: commTermsData,
licenseTermsData: commTermsData,
sigAttachAndConfig: WorkflowStructs.SignatureData({
signer: testSender,
deadline: deadline,
Expand Down
12 changes: 6 additions & 6 deletions test/workflows/DerivativeWorkflows.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ contract DerivativeWorkflowsTest is BaseTest {
using Strings for uint256;

address internal ipIdParent;
WorkflowStructs.PILTermsData[] internal nonCommTermsData;
WorkflowStructs.PILTermsData[] internal commTermsData;
WorkflowStructs.LicenseTermsData[] internal nonCommTermsData;
WorkflowStructs.LicenseTermsData[] internal commTermsData;
function setUp() public override {
super.setUp();
nonCommTermsData.push(
WorkflowStructs.PILTermsData({
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.nonCommercialSocialRemixing(),
licensingConfig: Licensing.LicensingConfig({
isSet: true,
Expand All @@ -42,7 +42,7 @@ contract DerivativeWorkflowsTest is BaseTest {
);

commTermsData.push(
WorkflowStructs.PILTermsData({
WorkflowStructs.LicenseTermsData({
terms: PILFlavors.commercialRemix({
mintingFee: 100 * 10 ** mockToken.decimals(),
commercialRevShare: 10 * 10 ** 6, // 10%
Expand All @@ -69,7 +69,7 @@ contract DerivativeWorkflowsTest is BaseTest {
spgNftContract: address(nftContract),
recipient: caller,
ipMetadata: ipMetadataDefault,
pilTermsData: nonCommTermsData,
licenseTermsData: nonCommTermsData,
allowDuplicates: true
});
}
Expand All @@ -82,7 +82,7 @@ contract DerivativeWorkflowsTest is BaseTest {
spgNftContract: address(nftContract),
recipient: caller,
ipMetadata: ipMetadataDefault,
pilTermsData: commTermsData,
licenseTermsData: commTermsData,
allowDuplicates: true
});
}
Expand Down
Loading

0 comments on commit 151b15d

Please sign in to comment.