Skip to content

Commit

Permalink
chore: clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgonzalezra committed Feb 3, 2024
1 parent dfe2ba9 commit bcfd8ef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions packages/contracts/src/LucidOrigins.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.23;
import { ERC721A } from "ERC721A/ERC721A.sol";
import { Encoder } from "./Encoder.sol";
import { Owned } from "solmate/auth/Owned.sol";
import { console2 } from "forge-std/console2.sol";
// import { console2 } from "forge-std/console2.sol";
import { Background } from "./layers/Background.sol";
import { Face } from "./layers/Face.sol";
import { Blush } from "./layers/Blush.sol";
Expand Down Expand Up @@ -65,7 +65,7 @@ contract LucidOrigins is Owned, ERC721A, Background, Face, Blob, Blush, Colors {
normalizeToRange(dna[Constants.EYE_PUPIL_RADIUS_INDEX], 0, 6),
fillColor
);
string memory svgContent = string.concat(layers, face, blush(normalizeToRange(dna[Constants.SIZE_INDEX], 2, layersLength).toString()));
string memory svgContent = string.concat(layers, face, blush(normalizeToRange(dna[Constants.SIZE_INDEX], 2, layersLength)));
uint256 rotation = normalizeToRange(dna[Constants.SIZE_INDEX], 0, 3);
string memory svg = string.concat(
'<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" width="400" height="400">',
Expand Down Expand Up @@ -162,7 +162,6 @@ contract LucidOrigins is Owned, ERC721A, Background, Face, Blob, Blush, Colors {
);

string memory fillColor = isPlain ? colors[color1] : "url(#linear-grad)";

return (colorDefs, fillColor);
}
}
3 changes: 1 addition & 2 deletions packages/contracts/src/layers/Background.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ contract Background {
int256[6] memory backgroundShapeMatrix,
string[4] memory backgroundColorMatrix,
uint256 base
) internal view returns (string memory) {
) internal pure returns (string memory) {
bool isPlain = base < 55;
bool isBiTone = base < 70;
bool isFullColor = base < 85;

string[3] memory paths = [
generatePath(
Expand Down
9 changes: 5 additions & 4 deletions packages/contracts/src/layers/Blush.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// SPDX-License-Identifier: GNU GPLv3
pragma solidity 0.8.23;
import { LibString } from "solmate/utils/LibString.sol";

contract Blush {
function blush(
string memory layerId
) internal pure returns (string memory) {
using LibString for uint256;

function blush(uint256 layerId) internal pure returns (string memory) {
return string.concat(
'<circle id="circle-blush" r="6" fill="rgba(255,255,255,0.4)" />',
'<animateMotion href="#circle-blush" dur="30s" begin="0s" ',
'fill="freeze" repeatCount="indefinite" rotate="auto-reverse" ',
'><mpath href="#',
layerId,
layerId.toString(),
'" /></animateMotion>'
);
}
Expand Down
1 change: 0 additions & 1 deletion packages/contracts/src/utils/constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ library Constants {

uint16 public constant COLOR1_INDEX = 18;
uint16 public constant COLOR2_INDEX = 19;

}

0 comments on commit bcfd8ef

Please sign in to comment.