Skip to content

Commit 1283c40

Browse files
committed
Enhance JSON metadata generation in ERC20FixedDenomination and update trait labels in EthscriptionsRendererLib
- Improved JSON metadata construction by escaping special characters in token name and symbol. - Added new trait for "Content URI SHA" in EthscriptionsRendererLib to provide additional metadata. - Updated trait labels for clarity, changing "Protocol" to "Protocol Name" and "Operation" to "Protocol Operation".
1 parent 0cfdbd6 commit 1283c40

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

contracts/src/ERC20FixedDenomination.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ contract ERC20FixedDenomination is ERC404NullOwnerCappedUpgradeable {
170170

171171
// Build the JSON metadata
172172
string memory jsonStart = string.concat(
173-
'{"name":"', name(), ' Token #', mintId.toString(), '"',
174-
',"description":"Fixed denomination token for ', mintAmount().toString(), ' ', symbol(), ' tokens"'
173+
'{"name":"', name().escapeJSON(), ' Token #', mintId.toString(), '"',
174+
',"description":"Fixed denomination token for ', mintAmount().toString(), ' ', symbol().escapeJSON(), ' tokens"'
175175
);
176176

177177
// Add ethscription ID and number
@@ -189,5 +189,4 @@ contract ERC20FixedDenomination is ERC404NullOwnerCappedUpgradeable {
189189

190190
return string.concat("data:application/json;base64,", Base64.encode(bytes(json)));
191191
}
192-
193192
}

contracts/src/libraries/EthscriptionsRendererLib.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ library EthscriptionsRendererLib {
4444
string memory part2 = string.concat(
4545
'"},{"trait_type":"Content Hash","value":"',
4646
uint256(etsc.contentHash).toHexString(32),
47+
'"},{"trait_type":"Content URI SHA","value":"',
48+
uint256(etsc.contentUriSha).toHexString(32),
4749
'"},{"trait_type":"MIME Type","value":"',
4850
mimetype.escapeJSON(),
4951
'"},{"trait_type":"ESIP-6","value":"',
@@ -54,13 +56,13 @@ library EthscriptionsRendererLib {
5456
string memory protocolAttrs = "";
5557
if (bytes(protocolName).length > 0) {
5658
protocolAttrs = string.concat(
57-
'"},{"trait_type":"Protocol","value":"',
59+
'"},{"trait_type":"Protocol Name","value":"',
5860
protocolName.escapeJSON()
5961
);
6062
if (bytes(operation).length > 0) {
6163
protocolAttrs = string.concat(
6264
protocolAttrs,
63-
'"},{"trait_type":"Operation","value":"',
65+
'"},{"trait_type":"Protocol Operation","value":"',
6466
operation.escapeJSON()
6567
);
6668
}

0 commit comments

Comments
 (0)