From efa930ccf68856a477e752731edb845e814cdbfd Mon Sep 17 00:00:00 2001 From: Gavin <5265021+g-a-v-i-n@users.noreply.github.com> Date: Wed, 13 Jul 2022 13:00:30 -0400 Subject: [PATCH] add backgroundColor to tokenURI (#62) * fix: glint was in there twice * change: token name and description * chore: makes Glint plural to Glints Co-authored-by: Nick Beattie --- src/libraries/Metadata.sol | 3 +++ src/libraries/Render.sol | 6 ++++-- src/libraries/Traits.sol | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libraries/Metadata.sol b/src/libraries/Metadata.sol index 8d31898..2df6984 100644 --- a/src/libraries/Metadata.sol +++ b/src/libraries/Metadata.sol @@ -19,6 +19,7 @@ library Metadata { string memory _name, string memory _description, string memory _attributes, + string memory _backgroundColor, string memory _svg ) internal pure returns (string memory) { string memory metadata = string.concat( @@ -31,6 +32,8 @@ library Metadata { ",", Util.keyValueNoQuotes("attributes", _attributes), ",", + Util.keyValue("backgroundColor", _backgroundColor), + ",", Util.keyValue("image", encodeSvg(_svg)), "}" ); diff --git a/src/libraries/Render.sol b/src/libraries/Render.sol index 5798c31..1254789 100644 --- a/src/libraries/Render.sol +++ b/src/libraries/Render.sol @@ -11,6 +11,7 @@ import {Glints} from "./Glints.sol"; import {Traits} from "./Traits.sol"; import {SVG} from "./SVG.sol"; import {Data} from "./Data.sol"; +import {Palette} from "./Palette.sol"; library Render { function tokenURI(uint256 _tokenId, bytes32 _seed) internal pure returns (string memory) { @@ -18,9 +19,10 @@ library Render { string( Metadata.encodeTokenMetadata( _tokenId, - tokenName("Bibo #", _tokenId), // name - "Bibos", // description + tokenName("Bibo ", _tokenId), // name + "Bibo bibo bibo", // description Traits.getTraits(_seed), // attributes + Palette.getBackgroundFill(_seed), // backgroundColor svg(_seed) // svg ) ); diff --git a/src/libraries/Traits.sol b/src/libraries/Traits.sol index 8084422..52dd34e 100644 --- a/src/libraries/Traits.sol +++ b/src/libraries/Traits.sol @@ -18,12 +18,11 @@ library Traits { string memory result = "["; result = string.concat(result, trait("Density", getDensityTrait(_seed))); result = string.concat(result, ",", trait("Polarity", getPolarityTrait(_seed))); - result = string.concat(result, ",", trait("Glint", getGlintTrait(_seed))); + result = string.concat(result, ",", trait("Glints", getGlintTrait(_seed))); result = string.concat(result, ",", trait("Mote", getMoteTrait(_seed))); result = string.concat(result, ",", trait("Eyes", getEyeTrait(_seed))); result = string.concat(result, ",", trait("Mouth", getMouthTrait(_seed))); result = string.concat(result, ",", trait("Cheeks", getCheekTrait(_seed))); - result = string.concat(result, ",", trait("Glints", getGlintTrait(_seed))); return string.concat(result, "]"); }