OwlFaceTrait

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

contract OwlFaceTrait {
    function renderTrait(uint256 seed, string memory color) external pure returns (string memory) {
        if (seed == 10) return renderFaceEyesOpen(color);
        if (seed == 11) return renderFaceSleeping(color);
        if (seed == 12) return renderFaceWink(color);
        if (seed == 13) return renderFaceSuspicious(color);
        if (seed == 14) return renderFaceWideEyed(color);
        if (seed == 15) return renderFaceGlasses(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 renderFaceEyesOpen(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="face-eyes-open">',
            makePath('131,150', 'M414 612q0 218 54 411t185 407h322q-240 -374 -240 -818q0 -439 240 -813h-322q-130 214 -184.5 406.5t-54.5 406.5z', color),
            makePath('143,150', 'M80 569q0 278 156 436t430 158t428.5 -158t154.5 -436q0 -277 -155 -435.5t-428 -158.5q-274 0 -430 158.5t-156 435.5zM399 569q0 -157 71 -246.5t196 -89.5q123 0 193.5 89.5t70.5 246.5q0 158 -70.5 247t-193.5 89q-125 0 -196 -89t-71 -247z', color),
            makePath('155,150', 'M365 -389l114 172l193 221l-193 -4v354h369v-354l-191 -389h-292z', color),
            makePath('167,150', 'M80 569q0 278 156 436t430 158t428.5 -158t154.5 -436q0 -277 -155 -435.5t-428 -158.5q-274 0 -430 158.5t-156 435.5zM399 569q0 -157 71 -246.5t196 -89.5q123 0 193.5 89.5t70.5 246.5q0 158 -70.5 247t-193.5 89q-125 0 -196 -89t-71 -247z', color),
            makePath('179,150', 'M356 -201q240 374 240 813q0 444 -240 818h322q131 -214 185.5 -407.5t54.5 -410.5q0 -214 -54.5 -406.5t-185.5 -406.5h-322z', color),
            '</g>'));
    }

    function renderFaceSleeping(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="face-sleeping">',
            makePath('131,150', 'M414 612q0 218 54 411t185 407h322q-240 -374 -240 -818q0 -439 240 -813h-322q-130 214 -184.5 406.5t-54.5 406.5z', color),
            makePath('143,150', 'M322 492v276h686v-276h-686z', color),
            makePath('155,150', 'M365 -389l114 172l193 221l-193 -4v354h369v-354l-191 -389h-292z', color),
            makePath('167,150', 'M322 492v276h686v-276h-686z', color),
            makePath('179,150', 'M356 -201q240 374 240 813q0 444 -240 818h322q131 -214 185.5 -407.5t54.5 -410.5q0 -214 -54.5 -406.5t-185.5 -406.5h-322z', color),
            '</g>'));
    }

    function renderFaceWink(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="face-wink">',
            makePath('131,150', 'M414 612q0 218 54 411t185 407h322q-240 -374 -240 -818q0 -439 240 -813h-322q-130 214 -184.5 406.5t-54.5 406.5z', color),
            makePath('143,150', 'M80 569q0 278 156 436t430 158t428.5 -158t154.5 -436q0 -277 -155 -435.5t-428 -158.5q-274 0 -430 158.5t-156 435.5zM399 569q0 -157 71 -246.5t196 -89.5q123 0 193.5 89.5t70.5 246.5q0 158 -70.5 247t-193.5 89q-125 0 -196 -89t-71 -247z', color),
            makePath('155,150', 'M365 -389l114 172l193 221l-193 -4v354h369v-354l-191 -389h-292z', color),
            makePath('167,150', 'M322 492v276h686v-276h-686z', color),
            makePath('179,150', 'M356 -201q240 374 240 813q0 444 -240 818h322q131 -214 185.5 -407.5t54.5 -410.5q0 -214 -54.5 -406.5t-185.5 -406.5h-322z', color),
            '</g>'));
    }

    function renderFaceSuspicious(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="face-suspicious">',
            makePath('131,150', 'M414 612q0 218 54 411t185 407h322q-240 -374 -240 -818q0 -439 240 -813h-322q-130 214 -184.5 406.5t-54.5 406.5z', color),
            makePath('143,150', 'M80 569q0 278 156 436t430 158t428.5 -158t154.5 -436q0 -277 -155 -435.5t-428 -158.5q-274 0 -430 158.5t-156 435.5zM399 569q0 -157 71 -246.5t196 -89.5q123 0 193.5 89.5t70.5 246.5q0 158 -70.5 247t-193.5 89q-125 0 -196 -89t-71 -247z', color),
            makePath('155,150', 'M365 -389l114 172l193 221l-193 -4v354h369v-354l-191 -389h-292z', color),
            makePath('167,150', 'M37 715q0 343 172.5 541t458.5 198t457 -197t171 -542q0 -343 -171.5 -541.5t-456.5 -198.5t-458 199.5t-173 540.5zM385 715q0 -216 79 -339.5t204 -123.5q123 0 201.5 123.5t78.5 339.5q0 218 -78 340.5t-202 122.5q-125 0 -204 -123.5t-79 -339.5z', color),
            makePath('179,150', 'M356 -201q240 374 240 813q0 444 -240 818h322q131 -214 185.5 -407.5t54.5 -410.5q0 -214 -54.5 -406.5t-185.5 -406.5h-322z', color),
            '</g>'));
    }

    function renderFaceWideEyed(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="face-wide-eyed">',
            makePath('131,150', 'M414 612q0 218 54 411t185 407h322q-240 -374 -240 -818q0 -439 240 -813h-322q-130 214 -184.5 406.5t-54.5 406.5z', color),
            makePath('143,150', 'M88 715q0 339 155 539t423 200q269 0 423 -199t154 -540q0 -340 -154 -540t-423 -200q-267 0 -422.5 201t-155.5 539zM436 715q0 -463 230 -463q231 0 231 463t-231 463q-230 0 -230 -463z', color),
            makePath('155,150', 'M365 -389l114 172l193 221l-193 -4v354h369v-354l-191 -389h-292z', color),
            makePath('167,150', 'M88 715q0 339 155 539t423 200q269 0 423 -199t154 -540q0 -340 -154 -540t-423 -200q-267 0 -422.5 201t-155.5 539zM436 715q0 -463 230 -463q231 0 231 463t-231 463q-230 0 -230 -463z', color),
            makePath('179,150', 'M356 -201q240 374 240 813q0 444 -240 818h322q131 -214 185.5 -407.5t54.5 -410.5q0 -214 -54.5 -406.5t-185.5 -406.5h-322z', color),
            '</g>'));
    }

    function renderFaceGlasses(string memory color) private pure returns (string memory) {
        return string(abi.encodePacked('<g id="face-glasses">',
            makePath('131,150', 'M414 612q0 218 54 411t185 407h322q-240 -374 -240 -818q0 -439 240 -813h-322q-130 214 -184.5 406.5t-54.5 406.5z', color),
            makePath('143,150', 'M80 569q0 278 156 436t430 158t428.5 -158t154.5 -436q0 -277 -155 -435.5t-428 -158.5q-274 0 -430 158.5t-156 435.5zM399 569q0 -157 71 -246.5t196 -89.5q123 0 193.5 89.5t70.5 246.5q0 158 -70.5 247t-193.5 89q-125 0 -196 -89t-71 -247z', color),
            makePath('155,150', 'M322 492v276h686v-276h-686z', color),
            makePath('167,150', 'M80 569q0 278 156 436t430 158t428.5 -158t154.5 -436q0 -277 -155 -435.5t-428 -158.5q-274 0 -430 158.5t-156 435.5zM399 569q0 -157 71 -246.5t196 -89.5q123 0 193.5 89.5t70.5 246.5q0 158 -70.5 247t-193.5 89q-125 0 -196 -89t-71 -247z', color),
            makePath('179,150', 'M356 -201q240 374 240 813q0 444 -240 818h322q131 -214 185.5 -407.5t54.5 -410.5q0 -214 -54.5 -406.5t-185.5 -406.5h-322z', color),
            '</g>'));
    }
}"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "viaIR": true,
    "evmVersion": "paris",
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    }
  }
}}

Tags:
Factory|addr:0x6d2e4caf153cdc77fc712b6d86552bc3120de678|verified:true|block:23440323|tx:0x12a8804e976f0ddfc899e6413ebfcf2f12088007c26dc625fd9e568f9fae74f1|first_check:1758810200

Submitted on: 2025-09-25 16:23:20

Comments

Log in to comment.

No comments yet.