From d151b8031973c98e3f18e3fbe0b7886119dd134a Mon Sep 17 00:00:00 2001 From: EmperorOrokuSaki Date: Thu, 15 Dec 2022 21:46:29 +0330 Subject: [PATCH] fix tokenURI return json --- contracts/FleekERC721.sol | 45 ++++++++++++--------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/contracts/FleekERC721.sol b/contracts/FleekERC721.sol index f8e7cc8..d20ae77 100644 --- a/contracts/FleekERC721.sol +++ b/contracts/FleekERC721.sol @@ -95,38 +95,21 @@ contract FleekERC721 is ERC721, FleekAccessControl { address owner = ownerOf(tokenId); App storage app = _apps[tokenId]; + // prettier-ignore bytes memory dataURI = abi.encodePacked( - "{", - '"name":"', - app.name, - '",', - '"description":"', - app.description, - '",', - '"owner":"', - Strings.toHexString(uint160(owner), 20), - '",', - '"external_url":"', - app.external_url, - '",', - '"image":"', - app.image, - '",', - '"attributes": [', - '{"trait_type": "ENS", "value":"', - app.ENS, - '"},', - '{"trait_type": "Commit Hash", "value":"', - app.builds[app.current_build].commit_hash, - '"},', - '{"trait_type": "Repository", "value":"', - app.builds[app.current_build].git_repository, - '"},', - '{"trait_type": "Version", "value":"', - Strings.toString(app.current_build), - '"}', - "]", - "}" + '{', + '"name":"', app.name, '",', + '"description":"', app.description, '",', + '"owner":"', Strings.toHexString(uint160(owner), 20), '",', + '"external_url":"', app.external_url, '",', + '"image":"', app.image, '",', + '"attributes": [', + '{"trait_type": "ENS", "value":"', app.ENS,'"},', + '{"trait_type": "Commit Hash", "value":"', app.builds[app.current_build].commit_hash,'"},', + '{"trait_type": "Repository", "value":"', app.builds[app.current_build].git_repository,'"},', + '{"trait_type": "Version", "value":"', Strings.toString(app.current_build),'"}', + ']', + '}' ); return string(abi.encodePacked(_baseURI(), Base64.encode((dataURI))));