Skip to content

Commit

Permalink
simplify licensing
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul committed Nov 17, 2023
1 parent 33a195a commit 85e242b
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 178 deletions.
1 change: 1 addition & 0 deletions contracts/StoryProtocol.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { LibRelationship } from "contracts/lib/modules/LibRelationship.sol";
import { Registration } from "contracts/lib/modules/Registration.sol";
import { ModuleRegistryKeys } from "contracts/lib/modules/ModuleRegistryKeys.sol";
import { Licensing } from "contracts/lib/modules/Licensing.sol";
import { FixedSet } from "contracts/utils/FixedSet.sol";
import "forge-std/console2.sol";

contract StoryProtocol {
Expand Down
13 changes: 3 additions & 10 deletions contracts/lib/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -254,35 +254,29 @@ library Errors {
////////////////////////////////////////////////////////////////////////////

/// @notice The franchise does not exist.
error LicensingModule_NonExistentIPOrg();
error LicensingModule_CallerNotIpOrgOwner();
error LicensingModule_InvalidConfigType();
error LicensingModule_InvalidTermCommercialStatus();
error LicensingModule_IpOrgFrameworkAlreadySet();
error LicensingModule_DuplicateTermId();
error LicensingModule_InvalidIntent();
error LicensingModule_IpaNotActive();
error LicensingModule_IpaIdRequired();
error LicensingModule_CommercialLicenseNotAllowed();
error LicensingModule_NonCommercialTermsRequired();
error LicensingModule_IpOrgNotConfigured();
error LicensingModule_ipOrgTermNotFound();
error LicensingModule_ShareAlikeDisabled();
error LicensingModule_InvalidAction();
error LicensingModule_LicenseAlreadyActivated();
error LicensingModule_CallerNotLicensor();
error LicensingModule_ParentLicenseNotActive();
error LicensingModule_InvalidIpa();
error LicensingModule_CallerNotLicenseOwner();

error LicensingModule_CantFindParentLicenseOrRelatedIpa();
error LicensingModule_InvalidLicenseeType();
error LicensingModule_InvalidLicensorType();
////////////////////////////////////////////////////////////////////////////
// LicenseRegistry //
////////////////////////////////////////////////////////////////////////////

error LicensingModule_InvalidLicenseeType();
error LicenseRegistry_ZeroIpaRegistryAddress();
error LicenseRegistry_LNFTShouldNotHaveIpaId();
error LicenseRegistry_BoundToIpaShouldHaveIpaId();
error LicenseRegistry_UnknownLicenseId();
error LicenseRegistry_NotLicenseNFT();
error LicenseRegistry_InvalidIpa();
Expand All @@ -292,7 +286,6 @@ library Errors {
error LicenseRegistry_LicenseNotPending();
error LicenseRegistry_InvalidLicenseStatus();


////////////////////////////////////////////////////////////////////////////
// RegistrationModule //
////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 0 additions & 4 deletions contracts/lib/modules/Licensing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ library Licensing {
ShortString[] termIds;
/// The data configuring each term. May be empty bytes. May be passed to the term hook
bytes[] termsData;
/// Future use
bytes data;
}

enum LicenseStatus {
Expand Down Expand Up @@ -70,8 +68,6 @@ library Licensing {
ShortString[] termIds;
/// The data configuring each term. May be empty bytes. May be passed to the term hook
bytes[] termsData;
/// Future use
bytes data;
}

enum LicenseeType {
Expand Down
13 changes: 11 additions & 2 deletions contracts/lib/modules/ProtocolLicensingTerms.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ pragma solidity ^0.8.19;

/// List of Licensing Term categories
library TermCategories {
string constant FORMAT = "FORMAT";
string constant CATEGORIZATION = "CATEGORIZATION";
string constant SHARE_ALIKE = "SHARE_ALIKE";
string constant ACTIVATION = "ACTIVATION";
string constant LICENSOR = "LICENSOR";
}

/// List of Protocol Term Ids (meaning the Licensing Module will have specific instructions
Expand All @@ -16,5 +17,13 @@ library TermIds {
string constant NFT_SHARE_ALIKE = "NFT_SHARE_ALIKE";
string constant LICENSOR_APPROVAL = "LICENSOR_APPROVAL";
string constant FORMAT_CATEGORY = "FORMAT_CATEGORY";

string constant LICENSOR_IPORG_OR_PARENT_LICENSOR = "LICENSOR_IPORG_OR_PARENT_LICENSOR";
}

library TermsData {
enum LicensorConfig {
Unset,
IpOrg,
ParentLicensor
}
}
6 changes: 2 additions & 4 deletions contracts/modules/licensing/LicenseRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ contract LicenseRegistry is ERC721 {
termIds: params_.termIds,
termsData: params_.termsData,
ipaId: ipaId_,
parentLicenseId: params_.parentLicenseId,
data: params_.data
parentLicenseId: params_.parentLicenseId
})
);
}
Expand Down Expand Up @@ -126,8 +125,7 @@ contract LicenseRegistry is ERC721 {
termIds: params_.termIds,
termsData: params_.termsData,
ipaId: 0,
parentLicenseId: params_.parentLicenseId,
data: params_.data
parentLicenseId: params_.parentLicenseId
})
);
_mint(licensee_, _licenseCount);
Expand Down
Loading

0 comments on commit 85e242b

Please sign in to comment.