SkullyBLONKSsvg

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "contracts/5_SkullyBLONKS.sol": {
      "content": "// SPDX-License-Identifier: Unlicensed\r
pragma solidity ^0.8.7;\r
\r
import "@openzeppelin/contracts/utils/Strings.sol";\r
\r
/// @title SkullyBLONKS SVG Contract v1.0\r
/// @author Matto\r
/// @notice This contract builds the SVG text.\r
/// @custom:security-contact monkmatto@protonmail.com\r
contract SkullyBLONKSsvg {\r
  using Strings for string;\r
\r
  function eM(uint256 _ent, uint256 _mod)\r
    internal\r
    pure\r
    returns (uint16) \r
  {\r
    return uint16(_ent % _mod);\r
  }\r
\r
  function bC(uint16 _r, uint16 _g, uint16 _b) \r
    internal\r
    pure\r
    returns (string memory)\r
  {\r
    return string(abi.encodePacked('rgb(',Strings.toString(_r),', ',Strings.toString(_g),', ',Strings.toString(_b),')"/>')); \r
  }\r
\r
  function rA(uint16 _x, uint16 _y, uint16 _w, uint16 _h, uint16 _r, uint16 _g, uint16 _b, uint16 _sw, uint16 _sc)\r
    internal\r
    pure\r
    returns (string memory)\r
  {\r
    return string(abi.encodePacked('<rect x="',Strings.toString(_x),'" y="',Strings.toString(_y),'" width="',Strings.toString(_w),'" height="',Strings.toString(_h),'" style="fill: rgb(',Strings.toString(_r),', ',Strings.toString(_g),', ',Strings.toString(_b),'); stroke-width: ',Strings.toString(_sw),'px; stroke: rgb(',Strings.toString(_sc),', ',Strings.toString(_sc),', ',Strings.toString(_sc),');"/>'));\r
  }\r
\r
  function rS(uint16 _x, uint16 _y, uint16 _w, uint16 _h, string memory _style)\r
    internal\r
    pure\r
    returns (string memory)\r
  {\r
    return string(abi.encodePacked('<rect x="',Strings.toString(_x),'" y="',Strings.toString(_y),'" width="',Strings.toString(_w),'" height="',Strings.toString(_h),'" style="fill: rgb',_style));\r
  }\r
\r
  function cS(uint16 _v, uint16 _mod)\r
    internal\r
    pure\r
    returns (uint16)\r
  {\r
    if (_v > _mod) {\r
      return _v - _mod;\r
    } else {\r
      return 255 - _mod + _v;\r
    }\r
  }\r
\r
  function assembleSVG(uint256 eO, uint256 eT, uint8[11] memory tA, uint16[110] memory loc)\r
    external\r
    pure\r
    returns (string memory)\r
  {\r
    // Variables\r
    string memory b = '<?xml version="1.0" encoding="utf-8"?><svg viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg">';\r
    string[3] memory s;\r
\r
    // Background Colors\r
    uint16 tR = 25 + (eM(eO,10) * 20);\r
    eO /= 10;\r
    uint16 tG = 25 + (eM(eO,10) * 20);\r
    eO /= 10;\r
    uint16 tB = 25 + (eM(eO,10) * 20);\r
    eO /= 10;\r
\r
    // Background\r
    if (tA[0] == 0) {\r
      b = string(abi.encodePacked(b,'<defs><linearGradient id="bkStyle"><stop offset="0" style="stop-color: rgb(255, 0, 0);"/><stop offset="0.17" style="stop-color: rgb(255, 170, 0);"/><stop offset="0.36" style="stop-color: rgb(255, 251, 0);"/><stop offset="0.52" style="stop-color: rgb(115, 255, 0);"/><stop offset="0.69" style="stop-color: rgb(0, 81, 255);"/><stop offset="0.85" style="stop-color: rgb(29, 1, 255);"/><stop offset="1" style="stop-color: rgb(102, 0, 255);"/></linearGradient></defs>'));\r
    } else if (tA[0] == 1) {\r
      b = string(abi.encodePacked(b,'<defs><linearGradient gradientUnits="userSpaceOnUse" x1="500" y1="0" x2="500" y2="1000" id="bkStyle"><stop offset="0" style="stop-color: #000000"/><stop offset="1" style="stop-color: ',bC(tR, tG, tB),'</linearGradient></defs>'));\r
    } else if (tA[0] == 2) {\r
      b = string(abi.encodePacked(b,'<defs><radialGradient gradientUnits="userSpaceOnUse" cx="500" cy="500" r="700" id="bkStyle"><stop offset="0" style="stop-color: #000000"/><stop offset="1" style="stop-color: ',bC(tR, tG, tB),'</radialGradient></defs>'));\r
    } else {\r
      b = string(abi.encodePacked(b,'<defs><radialGradient gradientUnits="userSpaceOnUse" cx="500" cy="500" r="490" id="bkStyle"><stop offset=".5" style="stop-color: #000000"/><stop offset="1" style="stop-color: ',bC(tR, tG, tB),'</radialGradient></defs>'));\r
    }\r
    b = string(abi.encodePacked(b,'<rect id="background" width="1000" height="1000"  style="fill: url(#bkStyle);" onclick="background.style.fill='));\r
    b = string(abi.encodePacked(b,"'rgba(0,0,0,0)'"));\r
    b = string(abi.encodePacked(b,'"/>'));\r
\r
    // Blonk Colors\r
    tR = 255 - tR;\r
    tG = 255 - tG;\r
    tB = 255 - tB;\r
\r
    // Neck\r
    b = string(abi.encodePacked(b,rA(loc[0] + loc[1] / 3, loc[3] + loc[5], loc[1] / 3, 1010 - loc[3] - loc[5], 244, 241, 233, 10, 32)));\r
\r
    // Head\r
    tR += 20;\r
    tG += 20;\r
    tB += 20;\r
    b = string(abi.encodePacked(b,rA(loc[2], loc[3], loc[4], loc[5], 249, 246, 238, 19, 42)));\r
\r
\r
    // Eyebrows\r
    b = string(abi.encodePacked(b,rA(loc[37], loc[38], loc[39], loc[40], 229, 226, 218, 0, 0)));\r
    b = string(abi.encodePacked(b,rA(loc[41], loc[42], loc[43], loc[44], 229, 226, 218, 0, 0)));\r
\r
    // Nose\r
    b = string(abi.encodePacked(b,rA(loc[24], loc[25], loc[26], loc[27], 0, 0, 0, 6, 55)));\r
\r
    // Eye Colors\r
    tR += 20 + eM(eO,10) * 9;\r
    eO /= 10;\r
    tG += 20 + eM(eO,10) * 9;\r
    eO /= 10;\r
    tB += 20 + eM(eO,10) * 9;\r
    eO /= 10;\r
\r
    // Eyes\r
    b = string(abi.encodePacked(b,rA(loc[6], loc[7], loc[8], loc[9], 0, 0, 0, 6, 55)));\r
    b = string(abi.encodePacked(b,rA(loc[10], loc[11], loc[12], loc[13], 0, 0, 0, 6, 55)));\r
\r
    // Pupils\r
    if (tA[1] == 1) {\r
      s[0] = '(210,42,42); stroke-width: 6px; stroke: rgb(205,37,37);"/>';\r
    } else if (tA[1] == 2) {\r
      s[0] = '(70,219,44); stroke-width: 6px; stroke: rgb(65,214,39);"/>';\r
    } else {\r
      s[0] = '(255,255,255); stroke-width: 6px; stroke: rgb(55,55,55);"/>';\r
    }\r
    b = string(abi.encodePacked(b,rS(loc[16], loc[17], loc[18], loc[19], s[0])));\r
    b = string(abi.encodePacked(b,rS(loc[20], loc[21], loc[22], loc[23], s[0])));\r
\r
    // Nose\r
    tR = cS(tR, 40) + eM(eO,10) * 9;\r
    eO /= 10;\r
    tG = cS(tG, 40) + eM(eO,10) * 9;\r
    eO /= 10;\r
    tB = cS(tB, 40) + eM(eO,10) * 9;\r
    eO /= 10;\r
\r
    // Ears\r
    tR = cS(tR, 40) + eM(eO,10) * 9;\r
    eO /= 10;\r
    tG = cS(tG, 40) + eM(eO,10) * 9;\r
    eO /= 10;\r
    tB = cS(tB, 40) + eM(eO,10) * 9;\r
    eO /= 10;\r
\r
    // jawline\r
    b = string(abi.encodePacked(b,rA(loc[2], loc[34], loc[4], 10, 42, 42, 42, 6, 42)));\r
\r
    // Mouth\r
    tR = cS(tR, 40) + eM(eT,10) * 9;\r
    eT /= 10;\r
    tG = cS(tG, 40) + eM(eT,10) * 9;\r
    eT /= 10;\r
    tB = cS(tB, 40) + eM(eT,10) * 9;\r
    eT /= 10;\r
    b = string(abi.encodePacked(b,rA(loc[33], loc[34], loc[35], loc[36], 0, 0, 0, 6, 42)));\r
\r
    // Teeth\r
    if (tA[2] > 0) {\r
      b = string(abi.encodePacked(b,rA(loc[50], loc[51], loc[52], loc[53], 249, 246, 238, 0, 0)));\r
    }\r
    if (tA[2] == 3) {\r
      b = string(abi.encodePacked(b,rA(loc[93], loc[94], loc[95], loc[96], 0, 0, 0, 0, 0))); // paints mouth over tusks\r
    }\r
\r
    // Mole\r
    if (loc[45] > 0) {\r
      b = string(abi.encodePacked(b,rA(loc[45], loc[106], loc[107], loc[108], 229, 226, 218, 0, 0)));     \r
    } \r
\r
    // Extra Detail\r
    s[0] = '(222,22,22);"/>'; // blood red\r
    if (tA[3] > 0) {\r
      b = string(abi.encodePacked(b,rS(loc[54], loc[55], loc[56], loc[57], s[0])));\r
      b = string(abi.encodePacked(b,rS(loc[58], loc[59], loc[60], loc[61], s[0])));\r
    }\r
\r
    // Glasses\r
    if (tA[4] == 1) {\r
      s[0] = '(32,32,32);"/>';\r
      s[1] = '(255,255,255); fill-opacity: 0.3; stroke-width: 16px; stroke: rgb(32,32,32);"/>';\r
      s[2] = s[1]; \r
    } else if (tA[4] == 2) {\r
      s[0] = '(243,104,203);"/>';\r
      s[1] = '(22,22,22); fill-opacity: 0.9; stroke-width: 16px; stroke: rgb(243,104,203);"/>';\r
      s[2] = s[1]; \r
    } else if (tA[4] == 3) {\r
      s[0] = '(245,245,245);"/>';\r
      s[2] = '(255,22,22); stroke-width: 16px; stroke: rgb(245,245,245);"/>';\r
      s[1] = '(22,122,255); stroke-width: 16px; stroke: rgb(245,245,245);"/>';\r
    } else if (tA[4] == 4) {\r
      s[0] = '(252,214,18);"/>';\r
      s[1] = '(11,11,11); stroke-width: 16px; stroke: rgb(252,214,18);"/>';\r
      s[2] = s[1]; \r
    }\r
    if (tA[4] != 0) {\r
      b = string(abi.encodePacked(b,rS(loc[62], loc[63], loc[64], loc[65],s[0])));\r
      b = string(abi.encodePacked(b,rS(loc[66], loc[67], loc[47], loc[46],s[1])));\r
      b = string(abi.encodePacked(b,rS(loc[68], loc[67], loc[47], loc[46],s[2])));\r
      b = string(abi.encodePacked(b,rS(loc[2] - 20, loc[70], loc[71] - (loc[2] - loc[69]) + 20, loc[65], s[0])));\r
      b = string(abi.encodePacked(b,rS(loc[72], loc[73], (loc[2] + loc[4]) - loc[72] + 20, loc[65], s[0])));\r
    }\r
\r
    // Hair\r
    tR = cS(tR, 20 + eM(eT,10) * 9);\r
    eT /= 10;\r
    tG = cS(tG, 20 + eM(eT,10) * 9);\r
    eT /= 10;\r
    tB = cS(tB, 20 + eM(eT,10) * 9);\r
    eT /= 10;\r
    if (tA[5] > 0) {\r
      b = string(abi.encodePacked(b,rA(loc[75], loc[76], loc[77], loc[78], tR, tG, tB, 0, 0)));\r
    }\r
    if (tA[5] == 3) {\r
      b = string(abi.encodePacked(b,rA(loc[79], loc[80], loc[81], loc[82], tR, tG, tB, 0, 0)));  \r
    }\r
    if (tA[6] > 0) {\r
      b = string(abi.encodePacked(b,rA(loc[87], loc[88], loc[89], loc[90], 252, 214, 18, 0, 0)));\r
    } \r
    if (tA[6] == 2) {\r
      b = string(abi.encodePacked(b,rA(loc[87], loc[91], loc[89], loc[92], 0, 120, 90, 0, 0)));\r
    }\r
    if (tA[5] == 3) {\r
      b = string(abi.encodePacked(b,rA(loc[83], loc[84], loc[85], loc[86], tR, tG, tB, 0, 0))); \r
    }\r
\r
    // Ear rings\r
    s[0] = '(242,242,255); stroke-width: 2px; stroke: rgb(233,233,242);"/>';\r
    if (tA[7] == 4) { \r
      s[0] = '(22,22,22); fill-opacity: 0.5; stroke-width: 8px; stroke: rgb(12,12,12);"/>';\r
      loc[48] = 20;\r
    }\r
    if (tA[7] == 1 || tA[7] == 3 || tA[7] == 4) {\r
      b = string(abi.encodePacked(b,rS(loc[28] + (loc[31] - loc[48]) / 2, 1000 - loc[48], loc[48], loc[48], s[0])));\r
    }\r
    if (tA[7] == 2 || tA[7] == 3 || tA[7] == 4) {\r
      b = string(abi.encodePacked(b,rS(loc[29] + (loc[31] - loc[48]) / 2, 1000 - loc[48], loc[48], loc[48], s[0])));\r
    }\r
    s[0] = '(252,214,18);"/>';\r
    if (tA[8] == 1 || tA[8] == 3) { \r
      b = string(abi.encodePacked(b,rS(loc[28] - 15, 985, 30, 15, s[0])));\r
    } \r
    if (tA[8] == 2 || tA[8] == 3) { \r
      b = string(abi.encodePacked(b,rS(loc[29] + loc[31] - 15, 985, 30, 15, s[0])));\r
    }\r
\r
    // Other\r
    tR = cS(tR, 40);\r
    tG = cS(tG, 40);\r
    tB = cS(tB, 40);\r
\r
    // neck thickness adjustment  \r
    if (tA[9] != 1) {\r
      loc[98] = loc[98] + loc[100] / 3 - 5;\r
      loc[100] = loc[100] / 3 + 10;\r
    }\r
\r
    if (tA[9] == 0) {\r
      b = string(abi.encodePacked(b,rA(loc[98], loc[99], loc[100], 1012 - loc[99], tR, tG, tB, 6, 32)));\r
    } else if (tA[9] == 1) {\r
      b = string(abi.encodePacked(b,rA(loc[98], loc[99], loc[100], loc[101], tR, tG, tB, 0, 0))); \r
      b = string(abi.encodePacked(b,rA(loc[102], loc[103], loc[104], loc[105], tR, tG, tB, 0, 0)));\r
      b = string(abi.encodePacked(b,rA(loc[97], loc[103], loc[104], loc[105], tR, tG, tB, 0, 0)));  \r
    } else if (tA[9] == 2) {\r
      b = string(abi.encodePacked(b,rS(loc[98], loc[99], loc[100], loc[101],'(32,32,32);"/>')));\r
    } else if (tA[9] == 3) {\r
      b = string(abi.encodePacked(b,rS(loc[98], loc[99], loc[100], loc[101],'(252,214,18);"/>')));\r
    } else if (tA[9] == 4) {\r
      b = string(abi.encodePacked(b,rS(loc[98], loc[99], loc[100], loc[101],'(8,8,8);"/>')));\r
    } else if (tA[9] == 5) {\r
      b = string(abi.encodePacked(b,rS(loc[98] - 30, loc[99], loc[100] + 60, loc[101], '(252,214,18);"/>')));\r
      b = string(abi.encodePacked(b,rS(loc[98], loc[99], loc[100], loc[101], '(0,120,90);"/>')));\r
    }\r
    b = string(abi.encodePacked(b,'</svg>'));\r
    return b;\r
  }\r
}"
    },
    "@openzeppelin/contracts/utils/Strings.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": []
  }
}}

Tags:
Factory|addr:0x9ce449a1e90c3a4601bd99f9bdfcf83ba193f12d|verified:true|block:23684707|tx:0x32a9d9c0035db192c1c97d717e2d4ef716caf2cfdf3b87f063ec82eadb37b340|first_check:1761761717

Submitted on: 2025-10-29 19:15:17

Comments

Log in to comment.

No comments yet.