Skip to content

Commit

Permalink
fix(PILTerms): add missing fields to PILTermsRenderer (storyprotoco…
Browse files Browse the repository at this point in the history
…l#274)

* fix(PILTerms): add missing fields to renderer

* fix(PILTerms): update renderer comments
  • Loading branch information
sebsadface authored Oct 16, 2024
1 parent 6fc339e commit 7d536c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions contracts/modules/licensing/PILTermsRenderer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ contract PILTermsRenderer {
// **Attributions**
string memory json = string(
abi.encodePacked(
'{"trait_type": "Royalty Policy", "value": "',
terms.royaltyPolicy.toHexString(),
'"},',
'{"trait_type": "Default Minting Fee", "value": "',
terms.defaultMintingFee.toString(),
'"},',
'{"trait_type": "Expiration", "value": "',
terms.expiration == 0 ? "never" : terms.expiration.toString(),
'"},',
Expand All @@ -30,7 +36,7 @@ contract PILTermsRenderer {
'{"trait_type": "URI", "value": "',
terms.uri,
'"},',
// Skip transferable, it's already added in the common attributes by the LicenseRegistry.
// Skip transferable, it's already added in the common attributes by LicenseToken (See {LicenseToken-tokenURI}).
_policyCommercialTraitsToJson(terms),
_policyDerivativeTraitsToJson(terms)
)
Expand Down Expand Up @@ -61,7 +67,7 @@ contract PILTermsRenderer {
'{"trait_type": "Commercial Revenue Ceiling", "value": ',
terms.commercialRevCeiling.toString(),
"},",
'{"trait_type": "Commercializer Check", "value": "',
'{"trait_type": "Commercializer Checker", "value": "',
terms.commercializerChecker.toHexString(),
// Skip on commercializerCheckerData as it's bytes as irrelevant for the user metadata
'"},'
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/LicenseToken.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ contract LicenseTokenTest is BaseTest {
);
expectedURI = abi.encodePacked(
expectedURI,
',"attributes": [{"trait_type": "Expiration", "value": "never"},{"trait_type": "Currency", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "URI", "value": ""},{"trait_type": "Commercial Use", "value": "false"},{"trait_type": "Commercial Attribution", "value": "false"},{"trait_type": "Commercial Revenue Share", "max_value": 1000, "value": 0},{"trait_type": "Commercial Revenue Ceiling", "value": 0},{"trait_type": "Commercializer Check", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "Derivatives Allowed", "value": "true"},{"trait_type": "Derivatives Attribution", "value": "true"},{"trait_type": "Derivatives Revenue Ceiling", "value": 0},{"trait_type": "Derivatives Approval", "value": "false"},{"trait_type": "Derivatives Reciprocal", "value": "true"}'
',"attributes": [{"trait_type": "Royalty Policy", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "Default Minting Fee", "value": "0"},{"trait_type": "Expiration", "value": "never"},{"trait_type": "Currency", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "URI", "value": ""},{"trait_type": "Commercial Use", "value": "false"},{"trait_type": "Commercial Attribution", "value": "false"},{"trait_type": "Commercial Revenue Share", "max_value": 1000, "value": 0},{"trait_type": "Commercial Revenue Ceiling", "value": 0},{"trait_type": "Commercializer Checker", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "Derivatives Allowed", "value": "true"},{"trait_type": "Derivatives Attribution", "value": "true"},{"trait_type": "Derivatives Revenue Ceiling", "value": 0},{"trait_type": "Derivatives Approval", "value": "false"},{"trait_type": "Derivatives Reciprocal", "value": "true"}'
);
expectedURI = abi.encodePacked(
expectedURI,
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/licensing/PILicenseTemplate.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ contract PILicenseTemplateTest is BaseTest {
function _DefaultToJson() internal pure returns (string memory) {
/* solhint-disable */
return
'{"trait_type": "Expiration", "value": "never"},{"trait_type": "Currency", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "URI", "value": ""},{"trait_type": "Commercial Use", "value": "false"},{"trait_type": "Commercial Attribution", "value": "false"},{"trait_type": "Commercial Revenue Share", "max_value": 1000, "value": 0},{"trait_type": "Commercial Revenue Ceiling", "value": 0},{"trait_type": "Commercializer Check", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "Derivatives Allowed", "value": "false"},{"trait_type": "Derivatives Attribution", "value": "false"},{"trait_type": "Derivatives Revenue Ceiling", "value": 0},{"trait_type": "Derivatives Approval", "value": "false"},{"trait_type": "Derivatives Reciprocal", "value": "false"},';
'{"trait_type": "Royalty Policy", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "Default Minting Fee", "value": "0"},{"trait_type": "Expiration", "value": "never"},{"trait_type": "Currency", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "URI", "value": ""},{"trait_type": "Commercial Use", "value": "false"},{"trait_type": "Commercial Attribution", "value": "false"},{"trait_type": "Commercial Revenue Share", "max_value": 1000, "value": 0},{"trait_type": "Commercial Revenue Ceiling", "value": 0},{"trait_type": "Commercializer Checker", "value": "0x0000000000000000000000000000000000000000"},{"trait_type": "Derivatives Allowed", "value": "false"},{"trait_type": "Derivatives Attribution", "value": "false"},{"trait_type": "Derivatives Revenue Ceiling", "value": 0},{"trait_type": "Derivatives Approval", "value": "false"},{"trait_type": "Derivatives Reciprocal", "value": "false"},';
/* solhint-enable */
}
}

0 comments on commit 7d536c7

Please sign in to comment.