OwlHeadTrait

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/OwlHeadTrait.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract OwlHeadTrait {
    function renderTrait(uint256 seed, string memory color) external pure returns (string memory) {
        if (seed == 10) return renderHeadEars(color);
        if (seed == 11) return renderHeadBald(color);
        if (seed == 12) return renderHeadPigtails(color);
        if (seed == 13) return renderHeadPunk(color);
        if (seed == 14) return renderHeadFeathers(color);
        if (seed == 15) return renderHeadHorns(color);
        if (seed == 16) return renderHeadCurly(color);

        return "";
    }

    function makePath(string memory pos, string memory pathData, string memory color) private pure returns (string memory) {
        return string(abi.encodePacked(
            '<g transform="translate(', pos, ') scale(0.011, -0.011)"><path d="',
            pathData, '" fill="', color, '"/></g>'
        ));
    }

    function renderHeadEars(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="head-ears">',
            makePath('138,134', 'M268 1563h340l-35 -637h-270z', color),
            makePath('146,134', 'M322 492v276h686v-276h-686z', color),
            makePath('160,134', 'M322 492v276h686v-276h-686z', color),
            makePath('175,134', 'M268 1563h340l-35 -637h-270z', color),
            '</g>'));
    }

    function renderHeadBald(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="head-bald">',
            makePath('142,130', 'M322 492v276h686v-276h-686z', color),
            makePath('154,130', 'M322 492v276h686v-276h-686z', color),
            makePath('166,130', 'M322 492v276h686v-276h-686z', color),
            '</g>'));
    }

    function renderHeadPigtails(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="head-pigtails">',
            makePath('126,129', 'M137 238v276h1055v-276h-1055zM137 731v277h1055v-277h-1055z', color),
            makePath('138,129', 'M137 489v277h389v389h277v-389h389v-277h-389v-391h-277v391h-389z', color),
            makePath('150,129', 'M137 238v276h1055v-276h-1055zM137 731v277h1055v-277h-1055z', color),
            makePath('162,129', 'M137 238v276h1055v-276h-1055zM137 731v277h1055v-277h-1055z', color),
            makePath('174,129', 'M137 489v277h389v389h277v-389h389v-277h-389v-391h-277v391h-389z', color),
            makePath('186,129', 'M137 238v276h1055v-276h-1055zM137 731v277h1055v-277h-1055z', color),
            '</g>'));
    }

    function renderHeadPunk(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="head-punk">',
            makePath('145,128', 'M102 -201l795 1635h330l-795 -1635h-330z', color),
            makePath('157,128', 'M102 -201l795 1635h330l-795 -1635h-330z', color),
            makePath('169,128', 'M102 -201l795 1635h330l-795 -1635h-330z', color),
            '</g>'));
    }

    function renderHeadFeathers(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="head-feathers">',
            makePath('142,132', 'M238 1075l75 213l232 -92v258h239v-258l234 92l76 -213l-256 -67l186 -201l-190 -139l-168 213l-168 -213l-189 139l185 201z', color),
            makePath('154,132', 'M238 1075l75 213l232 -92v258h239v-258l234 92l76 -213l-256 -67l186 -201l-190 -139l-168 213l-168 -213l-189 139l185 201z', color),
            makePath('166,132', 'M238 1075l75 213l232 -92v258h239v-258l234 92l76 -213l-256 -67l186 -201l-190 -139l-168 213l-168 -213l-189 139l185 201z', color),
            '</g>'));
    }

    function renderHeadHorns(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="head-horns">',
            makePath('142,126', 'M102 -201l795 1635h330l-795 -1635h-330z', color),
            makePath('154,126', 'M322 492v276h686v-276h-686z', color),
            makePath('166,126', 'M322 492v276h686v-276h-686z', color),
            makePath('178,126', 'M102 -201l795 1635h330l-795 -1635h-330z', color),
            '</g>'));
    }

    function renderHeadCurly(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="head-curly">',
            makePath('142,130', 'M84 428q0 97 33.5 177t87.5 129.5t119 76.5t133 27q64 0 128.5 -23.5t107 -51.5t89 -51.5t78.5 -23.5q45 0 77 39t38 102h272q-1 -93 -34 -171.5t-86 -129.5t-118.5 -79.5t-134.5 -28.5q-64 0 -128 23.5t-106 52t-89 52t-80 23.5q-47 0 -80.5 -40t-34.5 -103h-272z', color),
            makePath('154,130', 'M84 428q0 97 33.5 177t87.5 129.5t119 76.5t133 27q64 0 128.5 -23.5t107 -51.5t89 -51.5t78.5 -23.5q45 0 77 39t38 102h272q-1 -93 -34 -171.5t-86 -129.5t-118.5 -79.5t-134.5 -28.5q-64 0 -128 23.5t-106 52t-89 52t-80 23.5q-47 0 -80.5 -40t-34.5 -103h-272z', color),
            makePath('166,130', 'M84 428q0 97 33.5 177t87.5 129.5t119 76.5t133 27q64 0 128.5 -23.5t107 -51.5t89 -51.5t78.5 -23.5q45 0 77 39t38 102h272q-1 -93 -34 -171.5t-86 -129.5t-118.5 -79.5t-134.5 -28.5q-64 0 -128 23.5t-106 52t-89 52t-80 23.5q-47 0 -80.5 -40t-34.5 -103h-272z', color),
            '</g>'));
    }
}"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "viaIR": true,
    "evmVersion": "paris",
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    }
  }
}}

Tags:
Factory|addr:0xb5d20a7e654417f5bbac34273140cea75c79adb1|verified:true|block:23440322|tx:0x9b4af9e85c8dec1eb58b9582db8be569e824c572f5b32347f4ca927f5b2f8a18|first_check:1758810157

Submitted on: 2025-09-25 16:22:37

Comments

Log in to comment.

No comments yet.