Skip to content

Commit

Permalink
event for indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul committed Dec 8, 2023
1 parent 5454144 commit ebb9b70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
18 changes: 3 additions & 15 deletions contracts/interfaces/modules/licensing/ILicensingModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,13 @@ interface ILicensingModule {
/// @param frameworkId the ID of the licensing framework
/// @param url to the legal document
/// @param licensorConfig the configuration of the licensor
/// @param values the values of the parameters (tag and bytes value)
event IpOrgLicensingFrameworkSet(
address indexed ipOrg,
string frameworkId,
string url,
Licensing.LicensorConfig licensorConfig
);

/// Emits when an IP org sets a parameter of a licensing framework.
/// @param ipOrg address of the IP org
/// @param paramTag the tag of the parameter
/// @param paramType the default value of the parameter
/// @param paramValue the type of the parameter
event ParameterSet(
address indexed ipOrg,
string paramTag,
Licensing.ParameterType paramType,
bytes paramValue
Licensing.LicensorConfig licensorConfig,
Licensing.ParamValue[] values
);

/// Gets the licensing framework of an IP org.
Expand All @@ -42,6 +32,4 @@ interface ILicensingModule {
address ipOrg_,
string calldata paramTag_
) external view returns (bytes memory);


}
16 changes: 8 additions & 8 deletions contracts/modules/licensing/LicensingModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ contract LicensingModule is BaseModule, ILicensingModule {
bytes memory inputValue,
bytes memory ipOrgValue,
Licensing.ParamDefinition memory paramDef
) private view returns (bytes memory) {
) private pure returns (bytes memory) {
if (inputValue.length > 0) {
// If user has set it, but ipOrg has too, revert
if (ipOrgValue.length > 0) {
Expand Down Expand Up @@ -401,12 +401,6 @@ contract LicensingModule is BaseModule, ILicensingModule {
ipOrgAddress
];
uint256 numParams = configParams.length;
emit IpOrgLicensingFrameworkSet(
ipOrgAddress,
config.frameworkId,
LICENSING_FRAMEWORK_REPO.getLicenseTextUrl(config.frameworkId),
config.licensor
);
// Add the parameters to storage
for (uint256 i = 0; i < numParams; i++) {
Licensing.ParamValue memory param = configParams[i];
Expand All @@ -419,8 +413,14 @@ contract LicensingModule is BaseModule, ILicensingModule {
revert Errors.LicensingModule_InvalidParamValue();
}
paramValues[param.tag] = param.value;
emit ParameterSet(ipOrgAddress, param.tag.toString(), paramDef.paramType, param.value);
}
emit IpOrgLicensingFrameworkSet(
ipOrgAddress,
config.frameworkId,
LICENSING_FRAMEWORK_REPO.getLicenseTextUrl(config.frameworkId),
config.licensor,
configParams
);

return "";
}
Expand Down

0 comments on commit ebb9b70

Please sign in to comment.