Skip to content

Commit

Permalink
Dev (#247)
Browse files Browse the repository at this point in the history
* Adds core authorization and attribution to the GIPR (#157)

* Adds core authorization and attribution to the GIPR

* Fixes accidental old code merge

* Fixes IPAssetOrg Test

* Added callpath from SPG to ModuleRegistry, refactor Relationship module (#160)

* story protocol entrypoint

* remove event emitter

* refactor IPOrg

* fix

* register ipOrg

* wip

* module registry basic functionality

* remove leftover test

* module registry routing to modules

* add module registyr to SPG

* relationship registry

* connected SPG with protocol module

* config types

* test remove relationship

* relationship setting

* comments and fixes

* unify module registry events

* refactor selfParams into moduleParams

* view methods in IPAssetRegistry

---------

Co-authored-by: Raul <[email protected]>

* refactor_tests (#163)

Authored-by: Raul <[email protected]>

* Implementation of Hooks Architecture with Asynchronous and Synchronous Base Hooks (#161)

* Implementation of Hooks Architecture with Async and Sync Base Hooks

* Add TokenGatedHook Contract for NFT Ownership Verification (#167)

* Add TokenGatedHook Contract for NFT Ownership Verification

* Enhance HookRegistry to Support Separate Config (#171)

* Refactor HookRegistry to support multiple config domain

Introduce `registryKey` to separate different config domains.
And Integrating BaseModule and Hooks

* Upgrade openzeppline to 4.9.3 (#173)

* list all files in workspace

* upgrade openzepplin to 4.9.3

* IPOrg refactor for creation & registration  (#168)

* Refactors IP Org

* Adds scaffolding for metadata rendering and ip asset creation

* Modularizes IP Org transfers and adds metadata wrapping

* Adds IPOrg registration

* Fixes stack too deep

* Adds back hookregistrykey

* Fixes testing

* Finalizes registration module (adds necessary FEs needed for SPG integration)

* Fix transfer bug

* Refactor licensing (#170)

* configure ipOrg license

* terms repository, framework config

* wip

* introducing hooks for terms

* short string helpers

* terms hook

* licensing module, config ipOrg licensing framework

* cleanup

* IPA goes into IPAsset library

* deleted old interfaces

* delete old contracts

* refactored configuration to be purely terms based, testing creating licenses

* refactor TermsConfig, added FixedSet

* create root license

* minting LNFT

* refactor licensing term libs

* fix test

* refactor to account for enshrined share alike

* refactored IPA_LICENSE and SUBLICENSE_OF back into the licensing module

* simplified terms data

* add comments:

* more comments

* fixed comments and added access control to license registry

* import order

* todo hook key providing

* remove hardhat tests

* fixing compilation errors

* introducing ipa registration module

* temporally remove tests

---------

Co-authored-by: Raul <[email protected]>

* Refactor Access Control in HookRegistry Contract (#175)

* Refactor hook registry access control by IPOrg owner
* Add hooksRegistry() function to modules

* Iporg types and tests (#177)

* Adds testing for registration module

* Adds scaffolding for custom ipAssetTypes

* Remove old comments

* Adding support register IP Asset with user defined mediaURL (#181)

* License activation (#176)

* hookity hook

* hook ouuuut

* lol

* wip testing

* simplify licensing

* WIP

* fixes

* more fixes

* wip

* fix tests

* typo

* separated termrepository from accesscontrol

* Update contracts/modules/licensing/LicensingModule.sol

Co-authored-by: kingster-will <[email protected]>

---------

Co-authored-by: Raul <[email protected]>
Co-authored-by: kingster-will <[email protected]>

* Deployment scripts for Alpha release on Sepolia (#178)

* deploy stroy protocol contracts to Sepolia

* redeploy with latest change

* redeploy for with PR#181

* redeploy for with active license PR#176

* Update script/foundry/deployment/Main.s.sol

* Update script/foundry/deployment/Main.s.sol

---------

Co-authored-by: Ramarti <[email protected]>

* remove logs and add Multicall to StoryProtocol.sol (#186)

Co-authored-by: Raul <[email protected]>

* Fixes IP asset types (#179)

* Address a series issues of event (#187)

* Fix following issues
- remove underscore postfix from event field
- rename event field `ipaId` to `ipAssetId`
- fix wrong `owner` in IPOrgRegistered event
- add ipAssetTypes into IPOrgRegistered event
- remove `indexed` from string or array event fields
---------

Co-authored-by: Ramarti <[email protected]>

* Add E2E tests for Alpha (#189)

* Implementing Dual Licensing Model for Core and Extended Functionalities (#190)

* Apply dual licenses to source code, BUSL and MIT

* Connected IPOrg asset types to relationship module and removed IP Asset Type (#188)

* ip org types and elimination of ip asset type

* fixing tests

* refactor registration tests

* fixed existing tests

* test iporg

* test protocol relationship types configuration

* test relationship setting

* remove unused struct

* removed commented out code

* refactor tokenURI

* fix

---------

Co-authored-by: Raul <[email protected]>

* Temporarily Comment Out Unused Modules for Alpha Release Preparation (#191)

* Temporarily Comment Out Unused Modules for Alpha Release Preparation

We have temporarily commented out the Collect and Royalty
modules to streamline the codebase for the alpha release.

These changes are not permanent and these modules will
be reintroduced in future releases.

* Introduce solidity-docgen in the project for generating documents (#202)

Authored-by: Samuel Zhou

* cleanup deployment broadcast directory (#197)

* Adds detailed contract documentation (#203)

* Adds detailed documentation for major contracts

* Prevent complaining about max line

* Update Deployment Script and Re-deploy Protocol Contracts (#204)

* Update deployment script and Re-deploy protocol

* Test access control (#206)

* test access control

* test access controlled

---------

Co-authored-by: Raul <[email protected]>

* Remove 'indexed' from string relType events

* remove underscore postfix from registration events

* License refactor to simplify and fit Protocol IP License (#214)

* licensing framework repo

* config iporg

* WIP

* moved some verification to LicenseRegistry

* simplify libs

* wip

* addReciprocal is in LicenseRegistry for efficiency, non reciprocal has implementation, uncommented the rest

* wip testing licensing

* test create license

* test other happy paths and fixes

* some comments

* whitespace

* made default revoker configurable

---------

Co-authored-by: Raul <[email protected]>

* Increase Code Lines Coverage (Unit + Integration) (#216)

* Remove 'indexed' from string relType events

* Module registry events test

* Add make coverage script

* Add more access control tests

* Add more IPOrg (controller) tests

* fix: IPOrgTransferred event emit, cache record.owner for prevOwner event arg

* Add more test for IPOrg controller

Coverage except internal functions and `initialize` for upgradable. Need
to use harness for internal functions.

* Add basic tests for FixedSet util

* fix: FixedSet.UintSet indexOf argument signature

* Add integration tests to full line coverage

* Add coverage instruction

* Updated tests for e2e and modules

* Contract bug fix & comment nit

* lcov update

* Fix licensing module test cases

* Separate tests & remove lcov file

* deployment script with licensing module and sepolia (#224)

Co-authored-by: Raul <[email protected]>

* Emit license data (#228)

* emit License data and gas saving in reciprocals

* deployment

---------

Co-authored-by: Raul <[email protected]>

* Alpha agreement (#229)

* BUSL changed to alpha agreement

* verified deployment

---------

Co-authored-by: Raul <[email protected]>

* allow param def empty array

* fix empty config param array ipOrg

* Introducing Polygon Token Async Hook and Integration Async Hook with BaseModule (#230)

* Introduce PolygonTokenHook and integrate Async hook with BaseMoudle
- A new contract PolygonTokenHook is introduced. 
- The BaseModule contract is updated to support the execution of asynchronous hooks.
- The type of hook (synchronous or asynchronous) is determined by the first two bits of the hook address.

* Support Licensing Framework default values (#233)

* bitmask

* wip refactor derivatives to proper options

* wip, hitting stack too deep

* wip fixed stack too deep, fixing tests

* fix bitmask

* fix, test, remove logs, fix internal to pure

---------

Co-authored-by: Raul <[email protected]>

* refactor to SPUML, comments

* deployment

* fix dep script

* Adds authorization (#227)

Adds new authorization logic around the module registry

* Fix events (#237)

* fix emission for ipOrg config

* deployed fix events

---------

Co-authored-by: Raul <[email protected]>

* Add license metadata (#238)

* wip

* wip

* fix emission for ipOrg config

* metadata

* event for indexing

* Update test/foundry/lib/BitMask.t.sol

* Update test/foundry/lib/BitMask.t.sol

* fix

* deployment

---------

Co-authored-by: Raul <[email protected]>

* Improved Unit & Integration Test (#231)

* Remove 'indexed' from string relType events

* Module registry events test

* Add make coverage script

* Add more access control tests

* Add more IPOrg (controller) tests

* fix: IPOrgTransferred event emit, cache record.owner for prevOwner event arg

* Add more test for IPOrg controller

Coverage except internal functions and `initialize` for upgradable. Need
to use harness for internal functions.

* Add basic tests for FixedSet util

* fix: FixedSet.UintSet indexOf argument signature

* Add integration tests to full line coverage

* Add coverage instruction

* Updated tests for e2e and modules

* Contract bug fix & comment nit

* lcov update

* Fix licensing module test cases

* Separate tests & remove lcov file

* Update integration tests

* Small fixes for contracts & interfaces

* Update e2e and module tests & comment out unready fn

* Updated tests

* More integration tests

* Fix param comment

* Add integration tests, fix unit tests, fix contract bugs

* Remove commented out function

* Update LicensingModule.Licensing.t.sol

* Update LicensingModule.Config.t.sol

* Link existing license to ipa on creation (#239)

* fix emission for ipOrg config

* added optional ipa_param

* link ipa to license on creation

* deployment

---------

Co-authored-by: Raul <[email protected]>

* Format and commenting refactor (#241)

* Polishes comments and standardizes formatting

* Fixes more formatting

* Adds more comments

* Fixes minor doc error

* Comment licensing (#240)

* licensing lib commented

* framework repo

* comment licensing module

* fixes

* lint

---------

Co-authored-by: Raul <[email protected]>

* Small test coverages (#242)

* Add more nit tests for coverage

* Remove unused lib

* Remove library

* Fix nit testcase

* Readme (#243)

* readme

* renamed mvp folder to legacy

* fix image

---------

Co-authored-by: Raul <[email protected]>

* Update README.md

* Update README.md

* changeset

* changelog

* Update README.md

* Comments (#246)

* underscore bitmask lib

* comments

* comments and formatting

* licensing underscore

* busl

---------

Co-authored-by: Raul <[email protected]>

---------

Co-authored-by: Leeren <[email protected]>
Co-authored-by: Raul <[email protected]>
Co-authored-by: kingster-will <[email protected]>
Co-authored-by: Samuel Zhou <[email protected]>
Co-authored-by: Jongwon Park <[email protected]>
Co-authored-by: Kingster <[email protected]>
  • Loading branch information
7 people authored Dec 8, 2023
1 parent 7248437 commit 091f3c5
Show file tree
Hide file tree
Showing 22 changed files with 223 additions and 170 deletions.
23 changes: 12 additions & 11 deletions contracts/lib/BitMask.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,55 @@ pragma solidity ^0.8.19;
*/
library BitMask {
/// Returns whether the bit at `index` is set.
function _isSet(uint256 mask_, uint8 index_) internal pure returns (bool) {
function isSet(uint256 mask_, uint8 index_) internal pure returns (bool) {
uint256 indexMask = 1 << (index_ & 0xff);
return mask_ & indexMask != 0;
}

/// Sets the bit at `index` to the boolean `value`.
function _setTo(uint256 mask_, uint256 index_, bool value_) internal pure returns (uint256) {
function setTo(uint256 mask_, uint256 index_, bool value_) internal pure returns (uint256) {
if (value_) {
return _set(mask_, index_);
return set(mask_, index_);
} else {
return _unset(mask_, index_);
return unset(mask_, index_);
}
}

/// Sets the bit at `index`.
function _set(uint256 mask_, uint256 index_) internal pure returns (uint256) {
function set(uint256 mask_, uint256 index_) internal pure returns (uint256) {
uint256 indexMask = 1 << (index_ & 0xff);
return mask_ |= indexMask;
}

/// Unsets the bit at `index`.
function _unset(uint256 mask_, uint256 index_) internal pure returns (uint256) {
function unset(uint256 mask_, uint256 index_) internal pure returns (uint256) {
uint256 indexMask = 1 << (index_ & 0xff);
return mask_ &= ~indexMask;
}

/// Gets the indexes of the set bits in the mask as an array
function _getSetIndexes(uint256 mask_) internal pure returns (uint8[] memory) {
/// Gets the uint8 from the bitmask as an array
function getSetIndexes(uint256 mask_) internal pure returns (uint8[] memory) {
// Count the number of set bits to allocate the array size
uint256 count;
for (uint8 i = 0; i < 255; ++i) {
if (_isSet(mask_, i)) {
if (isSet(mask_, i)) {
++count;
}
}
uint8[] memory setBitIndexes = new uint8[](count);
// Fill the array with indices of set bits
uint256 index = 0;
for (uint8 i = 0; i < 255; ++i) {
if (_isSet(mask_, i)) {
if (isSet(mask_, i)) {
setBitIndexes[index] = i;
++index;
}
}
return setBitIndexes;
}

function _convertToMask(uint8[] memory indexes_) internal pure returns (uint256) {
/// Converts an array of uint8 to a bit mask
function convertToMask(uint8[] memory indexes_) internal pure returns (uint256) {
uint256 mask = 0;
for (uint256 i = 0; i < indexes_.length; ) {
mask |= 1 << (uint256(indexes_[i]) & 0xff);
Expand Down
3 changes: 2 additions & 1 deletion contracts/lib/hooks/TokenGated.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
// SPDX-License-Identifier: UNLICENSED
// See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf
pragma solidity ^0.8.19;

/// @title TokenGated
Expand Down
49 changes: 43 additions & 6 deletions contracts/lib/modules/LibRelationship.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,91 @@ pragma solidity ^0.8.19;

/// @title Relationship Module Library
library LibRelationship {
/// @notice defines the elements that can be related in a relationship type
enum Relatables {
UNDEFINED,
IPA,
IPORG_ENTRY,
LICENSE,
ADDRESS,
EXTERNAL_NFT
/// Unset value
Undefined,
/// The relationship type can be used to relate IPAs
Ipa,
/// The relationship type can be used to relate IPOrg token ids
IpOrgEntry,
/// The relationship type can be used to relate License token ids
License,
/// The relationship type can be used to relate Addresses
Address,
/// The relationship type can be used to relate External NFTs (e.g. ERC721)
ExternalNft
}

/// @notice defines the elements that can be related in a relationship type
struct RelatedElements {
/// Source type
Relatables src;
/// Destination type
Relatables dst;
}

/// @notice defines 2 related elements under a certain type
struct Relationship {
/// Relationship type name id
string relType;
/// Source address
address srcAddress;
/// Destination address
address dstAddress;
/// Source id (or zero if not applicable)
uint256 srcId;
/// Destination id (or zero if not applicable)
uint256 dstId;
}

/// @notice defines the parameters for adding a relationship type
struct AddRelationshipTypeParams {
/// Relationship type name id
string relType;
/// IP Org address or zero address for protocol level rel types
address ipOrg;
/// Source and destination types
RelatedElements allowedElements;
/// Source ipOrgs types allowed or empty array if not applicable
uint8[] allowedSrcs;
/// Destination ipOrgs types allowed or empty array if not applicable
uint8[] allowedDsts;
}

/// @notice defines the parameters to define a relationship type
struct RelationshipType {
/// Allowed source address
address src;
/// Allowd source subtypes (bitmask verion of allowedSrcs)
uint256 srcSubtypesMask;
/// Allowed destination address
address dst;
/// Allowed destination subtypes (bitmask verion of allowedDsts)
uint256 dstSubtypesMask;
}

/// @notice defines the parameters for creating a relationship
struct CreateRelationshipParams {
/// Relationship type name id
string relType;
/// Source address
address srcAddress;
/// Source id or zero if not applicable
uint256 srcId;
/// Destination address
address dstAddress;
/// Destination id or zero if not applicable
uint256 dstId;
}

/// Constant for protocol level relationship types
address public constant PROTOCOL_LEVEL_RELATIONSHIP = address(0);
/// Any address goes
address public constant NO_ADDRESS_RESTRICTIONS = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;

/// Action to configure a relationship type in Relationship Module
bytes32 public constant ADD_REL_TYPE_CONFIG = keccak256("ADD_REL_TYPE");
/// Action to remove a relationship type in Relationship Module
bytes32 public constant REMOVE_REL_TYPE_CONFIG = keccak256("REMOVE_REL_TYPE");
}
22 changes: 11 additions & 11 deletions contracts/lib/modules/Licensing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ library Licensing {
bytes32 public constant LINK_LNFT_TO_IPA = keccak256("LINK_LNFT_TO_IPA");

/// @notice Returns the string representation of a license status.
function _statusToString(LicenseStatus status_) internal pure returns (string memory) {
function statusToString(LicenseStatus status_) internal pure returns (string memory) {
if (status_ == LicenseStatus.Unset) {
return "Unset";
} else if (status_ == LicenseStatus.Active) {
Expand All @@ -161,12 +161,12 @@ library Licensing {
/// @param value the encoded value
/// @param availableChoices the encoded available choices for the parameter, defined in parameter
/// definition
function _decodeMultipleChoice(
function decodeMultipleChoice(
bytes memory value,
bytes memory availableChoices
) internal pure returns (ShortString[] memory) {
uint256 mask = abi.decode(value, (uint256));
uint8[] memory indexes = BitMask._getSetIndexes(mask);
uint8[] memory indexes = BitMask.getSetIndexes(mask);
ShortString[] memory choices = abi.decode(availableChoices, (ShortString[]));
ShortString[] memory result = new ShortString[](indexes.length);
for (uint256 i = 0; i < indexes.length; i++) {
Expand All @@ -179,8 +179,8 @@ library Licensing {
/// and encodes it into bytes
/// @param choiceIndexes_ the indexes of the chosen options
/// @return value the encoded value
function _encodeMultipleChoice(uint8[] memory choiceIndexes_) internal pure returns (bytes memory value) {
uint256 mask = BitMask._convertToMask(choiceIndexes_);
function encodeMultipleChoice(uint8[] memory choiceIndexes_) internal pure returns (bytes memory value) {
uint256 mask = BitMask.convertToMask(choiceIndexes_);
return abi.encode(mask);
}

Expand All @@ -190,7 +190,7 @@ library Licensing {
/// so they should be done off chain. Also, Boolean decoded as a Number will be valid.
/// @param paramDef_ the parameter definition
/// @param value_ the encoded value
function _validateParamValue(ParamDefinition memory paramDef_, bytes memory value_) internal pure returns (bool) {
function validateParamValue(ParamDefinition memory paramDef_, bytes memory value_) internal pure returns (bool) {
// An empty value signals the parameter is untagged, to trigger default values in the
// license agreement text, but that's valid
if (keccak256(value_) == keccak256("")) {
Expand Down Expand Up @@ -231,7 +231,7 @@ library Licensing {
/// metadata rendering.
/// @param ss the ShortString[]
/// @return the string representation of a JSON array
function _shortStringArrayToJsonArray(ShortString[] memory ss) internal pure returns (string memory) {
function shortStringArrayToJsonArray(ShortString[] memory ss) internal pure returns (string memory) {
string memory result = "[";
uint256 len = ss.length;
for (uint256 i = 0; i < len; i++) {
Expand All @@ -249,7 +249,7 @@ library Licensing {
/// @param paramDef_ the parameter definition
/// @param value_ the encoded value
/// @return the string representation of the value
function _getDecodedParamString(
function getDecodedParamString(
Licensing.ParamDefinition memory paramDef_,
bytes memory value_
) internal pure returns (string memory) {
Expand All @@ -264,10 +264,10 @@ library Licensing {
return Strings.toHexString(uint160(addr), 20);
} else if (paramDef_.paramType == Licensing.ParameterType.ShortStringArray) {
ShortString[] memory choices = abi.decode(value_, (ShortString[]));
return _shortStringArrayToJsonArray(choices);
return shortStringArrayToJsonArray(choices);
} else if (paramDef_.paramType == Licensing.ParameterType.MultipleChoice) {
ShortString[] memory choices = _decodeMultipleChoice(value_, paramDef_.availableChoices);
return _shortStringArrayToJsonArray(choices);
ShortString[] memory choices = decodeMultipleChoice(value_, paramDef_.availableChoices);
return shortStringArrayToJsonArray(choices);
}
return "";
}
Expand Down
3 changes: 2 additions & 1 deletion contracts/lib/modules/Module.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
// SPDX-License-Identifier: UNLICENSED
// See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf
pragma solidity ^0.8.19;

// This file contains module structures and constants used throughout Story Protocol.
Expand Down
20 changes: 15 additions & 5 deletions contracts/lib/modules/SPUMLParams.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ pragma solidity ^0.8.19;
import { Licensing } from "contracts/lib/modules/Licensing.sol";
import { ShortString, ShortStrings } from "@openzeppelin/contracts/utils/ShortStrings.sol";

/// List of Protocol Term Ids (meaning the Licensing Module will have specific instructions
/// for these terms without the need of a decoder)
/// @title SPUMLParams Library
/// Defines the parameters for the SPUML license.
/// See: https://github.com/storyprotocol/protocol-contracts/blob/main/SPUML-v1.pdf
/// @dev must be < 32 bytes long, or they will blow up at some point
/// see https://docs.openzeppelin.com/contracts/4.x/api/utils#ShortStrings
library SPUMLParams {
Expand All @@ -16,18 +17,25 @@ library SPUMLParams {
////////////////////////////////////////////////////////////////////////////
// Parameters //
////////////////////////////////////////////////////////////////////////////
/// Sets allowed channels of distribution for the IPA
string public constant CHANNELS_OF_DISTRIBUTION = "Channels-Of-Distribution";
/// Sets whether attribution is required in reproductions of the IPA
string public constant ATTRIBUTION = "Attribution";
/// Sets whether derivatives are allowed for the IPA
string public constant DERIVATIVES_ALLOWED = "Derivatives-Allowed";
/// Sets the allowed derivative conditions for the IPA
string public constant DERIVATIVES_ALLOWED_OPTIONS = "Derivatives-Allowed-Options";

////////////////////////////////////////////////////////////////////////////
// Derivative Options //
////////////////////////////////////////////////////////////////////////////
/// Licensor must activate license before linking with IPA
string public constant ALLOWED_WITH_APPROVAL = "Allowed-With-Approval";
uint8 public constant ALLOWED_WITH_APPROVAL_INDEX = 0;
/// Licensee must license derivative under same terms. No licensor restrictions
string public constant ALLOWED_WITH_RECIPROCAL_LICENSE = "Allowed-Reciprocal-License";
uint8 public constant ALLOWED_WITH_RECIPROCAL_LICENSE_INDEX = 1;
/// Licensee must attribute licensor when using derivative
string public constant ALLOWED_WITH_ATTRIBUTION = "Allowed-With-Attribution";
uint8 public constant ALLOWED_WITH_ATTRIBUTION_INDEX = 2;

Expand All @@ -53,15 +61,17 @@ library SPUMLParams {
// string constant ALLOWED_WITH_REVENUE_CEILING = "Allowed-With-Revenue-Ceiling";
// string constant DERIVATIVES_ALLOWED_TAG_AMOUNT = "Derivatives-Allowed-Tag-Amount";

function _getDerivativeChoices() internal pure returns (ShortString[] memory) {
/// @notice Returns the options for the derivative allowed parameter
function getDerivativeChoices() internal pure returns (ShortString[] memory) {
ShortString[] memory choices = new ShortString[](3);
choices[0] = ALLOWED_WITH_APPROVAL.toShortString();
choices[1] = ALLOWED_WITH_RECIPROCAL_LICENSE.toShortString();
choices[2] = ALLOWED_WITH_ATTRIBUTION.toShortString();
return choices;
}

function _getParamDefs() internal pure returns (Licensing.ParamDefinition[] memory paramDefs) {
/// @notice Returns the parameter definitions for the SPUML license
function getParamDefs() internal pure returns (Licensing.ParamDefinition[] memory paramDefs) {
paramDefs = new Licensing.ParamDefinition[](4);
paramDefs[0] = Licensing.ParamDefinition(
CHANNELS_OF_DISTRIBUTION.toShortString(),
Expand All @@ -85,7 +95,7 @@ library SPUMLParams {
DERIVATIVES_ALLOWED_OPTIONS.toShortString(),
Licensing.ParameterType.MultipleChoice,
"", // Since this is dependent on the above, default is unset
abi.encode(_getDerivativeChoices())
abi.encode(getDerivativeChoices())
);
}
}
3 changes: 2 additions & 1 deletion contracts/modules/Gateway.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
// SPDX-License-Identifier: UNLICENSED
// See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf
pragma solidity ^0.8.19;

import { Errors } from "contracts/lib/Errors.sol";
Expand Down
4 changes: 2 additions & 2 deletions contracts/modules/licensing/LicenseRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ contract LicenseRegistry is ERC721 {
LICENSING_FRAMEWORK_REPO.getLicenseTextUrl(license.frameworkId.toString()),
'"},',
'{"trait_type": "Status", "value": "',
Licensing._statusToString(license.status),
Licensing.statusToString(license.status),
'"},'
)
/* solhint-enable */
Expand Down Expand Up @@ -302,7 +302,7 @@ contract LicenseRegistry is ERC721 {
license.frameworkId.toString(),
params[i].tag
);
string memory value = Licensing._getDecodedParamString(paramDef, params[i].value);
string memory value = Licensing.getDecodedParamString(paramDef, params[i].value);

if (
paramDef.paramType != Licensing.ParameterType.MultipleChoice &&
Expand Down
8 changes: 4 additions & 4 deletions contracts/modules/licensing/LicensingModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ contract LicensingModule is BaseModule, ILicensingModule {
derivativesAllowed = abi.decode(resultValue, (bool));
} else if (ShortStringOps._equal(paramDef.tag, SPUMLParams.DERIVATIVES_ALLOWED_OPTIONS)) {
uint256 derivativeIndexMask = abi.decode(resultValue, (uint256));
derivativeNeedsApproval = BitMask._isSet(derivativeIndexMask, SPUMLParams.ALLOWED_WITH_APPROVAL_INDEX);
isReciprocal = BitMask._isSet(derivativeIndexMask, SPUMLParams.ALLOWED_WITH_RECIPROCAL_LICENSE_INDEX);
derivativeNeedsApproval = BitMask.isSet(derivativeIndexMask, SPUMLParams.ALLOWED_WITH_APPROVAL_INDEX);
isReciprocal = BitMask.isSet(derivativeIndexMask, SPUMLParams.ALLOWED_WITH_RECIPROCAL_LICENSE_INDEX);
}
}
// In case there is misconfiguration.
Expand All @@ -315,7 +315,7 @@ contract LicensingModule is BaseModule, ILicensingModule {
revert Errors.LicensingModule_ParamSetByIpOrg();
}
// If user has set it and ipOrg has not, user value selected
if (!Licensing._validateParamValue(paramDef, inputValue)) {
if (!Licensing.validateParamValue(paramDef, inputValue)) {
// hoping to catch some bad encoding
revert Errors.LicensingModule_InvalidInputValue();
}
Expand Down Expand Up @@ -424,7 +424,7 @@ contract LicensingModule is BaseModule, ILicensingModule {
config.frameworkId,
param.tag
);
if (!Licensing._validateParamValue(paramDef, param.value)) {
if (!Licensing.validateParamValue(paramDef, param.value)) {
revert Errors.LicensingModule_InvalidParamValue();
}
paramValues[param.tag] = param.value;
Expand Down
Loading

0 comments on commit 091f3c5

Please sign in to comment.