From 89db11a9668b18a0b6e80932783b20c219247307 Mon Sep 17 00:00:00 2001 From: e6f4e37l <66016924+fiveoutofnine@users.noreply.github.com> Date: Fri, 17 Nov 2023 18:46:12 -0500 Subject: [PATCH] feat: remove shields from art --- .gitmodules | 3 -- foundry.toml | 1 - lib/shields-api-contract | 1 - src/AuthorshipToken.sol | 66 ++++++---------------------------------- 4 files changed, 10 insertions(+), 61 deletions(-) delete mode 160000 lib/shields-api-contract diff --git a/.gitmodules b/.gitmodules index 5de1599..b153367 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,6 @@ [submodule "lib/solmate"] path = lib/solmate url = https://github.com/transmissions11/solmate -[submodule "lib/shields-api-contract"] - path = lib/shields-api-contract - url = https://github.com/area-technology/shields-api-contract [submodule "lib/solady"] path = lib/solady url = https://github.com/vectorized/solady diff --git a/foundry.toml b/foundry.toml index 149a025..07bba99 100644 --- a/foundry.toml +++ b/foundry.toml @@ -9,7 +9,6 @@ remappings = [ "colormap-registry/=lib/colormap-registry/src/", "forge-std/=lib/forge-std/src/", "solady/=lib/solady/src/", - "shields-api/=lib/shields-api-contract/contracts/", "solmate/=lib/solmate/src/", "@/script/=script/", "@/contracts/=src/", diff --git a/lib/shields-api-contract b/lib/shields-api-contract deleted file mode 160000 index 3fd0d73..0000000 --- a/lib/shields-api-contract +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3fd0d731cfc6ce099115eb7ebac76555d5617741 diff --git a/src/AuthorshipToken.sol b/src/AuthorshipToken.sol index a5f887c..1e57286 100644 --- a/src/AuthorshipToken.sol +++ b/src/AuthorshipToken.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.17; -import { IShieldsAPI } from "shields-api/interfaces/IShieldsAPI.sol"; import { Base64 } from "solady/utils/Base64.sol"; import { LibString } from "solady/utils/LibString.sol"; import { Owned } from "solmate/auth/Owned.sol"; @@ -22,17 +21,6 @@ import { ICurta } from "@/contracts/interfaces/ICurta.sol"; contract AuthorshipToken is ERC721, Owned { using LibString for uint256; - // ------------------------------------------------------------------------- - // Constants - // ------------------------------------------------------------------------- - - /// @notice The shields API contract. - /// @dev This is the mainnet address. - IShieldsAPI constant shieldsAPI = IShieldsAPI(0x740CBbF0116a82F64e83E1AE68c92544870B0C0F); - - /// @notice Salt used to compute the seed in {AuthorshipToken.tokenURI}. - bytes32 constant SALT = bytes32("Curta.AuthorshipToken"); - // ------------------------------------------------------------------------- // Errors // ------------------------------------------------------------------------- @@ -141,36 +129,6 @@ contract AuthorshipToken is ERC721, Owned { function tokenURI(uint256 _tokenId) public view override returns (string memory) { require(_ownerOf[_tokenId] != address(0), "NOT_MINTED"); - // Generate seed. - uint256 seed = uint256(keccak256(abi.encodePacked(_tokenId, SALT))); - - // Bitpacked colors. - uint256 colors = 0x6351CEFF00FFB300FF6B00B5000A007FFF78503C323232FE7FFF6C28A2FF007A; - - // Shuffle `colors` by performing 4 iterations of Fisher-Yates shuffle. - // We do this to pick 4 unique colors from `colors`. - unchecked { - uint256 shift = 24 * (seed % 11); - colors = (colors & ((type(uint256).max ^ (0xFFFFFF << shift)) ^ 0xFFFFFF)) - | ((colors & 0xFFFFFF) << shift) | ((colors >> shift) & 0xFFFFFF); - seed >>= 4; - - shift = 24 * (seed % 10); - colors = (colors & ((type(uint256).max ^ (0xFFFFFF << shift)) ^ (0xFFFFFF << 24))) - | (((colors >> 24) & 0xFFFFFF) << shift) | (((colors >> shift) & 0xFFFFFF) << 24); - seed >>= 4; - - shift = 24 * (seed % 9); - colors = (colors & ((type(uint256).max ^ (0xFFFFFF << shift)) ^ (0xFFFFFF << 48))) - | (((colors >> 48) & 0xFFFFFF) << shift) | (((colors >> shift) & 0xFFFFFF) << 48); - seed >>= 4; - - shift = 24 * (seed & 7); - colors = (colors & ((type(uint256).max ^ (0xFFFFFF << shift)) ^ (0xFFFFFF << 72))) - | (((colors >> 72) & 0xFFFFFF) << shift) | (((colors >> shift) & 0xFFFFFF) << 72); - seed >>= 3; - } - return string.concat( "data:application/json;base64,", Base64.encode( @@ -375,20 +333,16 @@ contract AuthorshipToken is ERC721, Owned { ".688 5.12 2.688 4.192 0 7.392-3.488 7.392-9.024 0-5.504-3.2-8.992-7.39" '2-8.992-2.304 0-4.096.992-5.12 2.688v-2.304h-3.808Z" fill="#F0F6FC"/><' 'path class="k" stroke-dashoffset="5" stroke-dasharray="10" d="M215 545' - 'h320"/>', - shieldsAPI.getShieldSVG({ - field: uint16(seed % 300), - colors: [ - uint24(colors & 0xFFFFFF), - uint24((colors >> 24) & 0xFFFFFF), - uint24((colors >> 48) & 0xFFFFFF), - uint24((colors >> 72) & 0xFFFFFF) - ], - hardware: uint16((seed >> 9) % 120), - frame: uint16((seed >> 17) % 5) - }), - '#', + 'h320"/>#', _zfill(_tokenId), '