ETH Price: $3,193.54 (+1.95%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Seeder

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
File 1 of 3 : Seeder.sol
// SPDX-License-Identifier: GPL-3.0

/// @title The WizardsToken pseudo-random seed generator.
// Modified version from NounsDAO.

pragma solidity ^0.8.6;

import {ISeeder} from "./ISeeder.sol";
import {IDescriptor} from "../descriptor/IDescriptor.sol";

contract Seeder is ISeeder {
    struct Counts {
        uint256 backgroundCount;
        uint256 skinsCount;
        uint256 mouthsCount;
        uint256 eyesCount;
        uint256 hatsCount;
        uint256 clothesCount;
        uint256 accessoryCount;
        uint256 bgItemCount;
    }

    /**
     * @notice Generate a pseudo-random Wizard seed using the previous blockhash and wizard ID.
     */
    function generateSeed(
        uint256 wizardId,
        IDescriptor descriptor,
        bool isOneOfOne,
        uint48 oneOfOneIndex
    ) external view override returns (Seed memory) {
        if (isOneOfOne) {
            return
                Seed({
                    background: 0,
                    skin: 0,
                    bgItem: 0,
                    accessory: 0,
                    clothes: 0,
                    mouth: 0,
                    eyes: 0,
                    hat: 0,
                    oneOfOne: isOneOfOne,
                    oneOfOneIndex: oneOfOneIndex
                });
        }

        uint256 pseudorandomness = getRandomness(wizardId);
        Counts memory counts = getCounts(descriptor);
        uint256 accShift = getAccShift(wizardId);
        uint256 clothShift = getClothShift(wizardId);

        return
            Seed({
                background: uint48(
                    uint48(pseudorandomness) % counts.backgroundCount
                ),
                skin: uint48(
                    uint48(pseudorandomness >> 48) % counts.skinsCount
                ),
                accessory: uint48(
                    uint48(pseudorandomness >> accShift) % counts.accessoryCount
                ),
                mouth: uint48(
                    uint48(pseudorandomness >> 144) % counts.mouthsCount
                ),
                eyes: uint48(
                    uint48(pseudorandomness >> 192) % counts.eyesCount
                ),
                hat: uint48(uint48(pseudorandomness >> 144) % counts.hatsCount),
                bgItem: uint48(
                    uint48(pseudorandomness >> accShift) % counts.bgItemCount
                ),
                clothes: uint48(
                    uint48(pseudorandomness >> clothShift) % counts.clothesCount
                ),
                oneOfOne: isOneOfOne,
                oneOfOneIndex: oneOfOneIndex
            });
    }

    function getCounts(IDescriptor descriptor)
        internal
        view
        returns (Counts memory)
    {
        return
            Counts({
                backgroundCount: descriptor.backgroundCount(),
                skinsCount: descriptor.skinsCount(),
                mouthsCount: descriptor.mouthsCount(),
                eyesCount: descriptor.eyesCount(),
                hatsCount: descriptor.hatsCount(),
                clothesCount: descriptor.clothesCount(),
                accessoryCount: descriptor.accessoryCount(),
                bgItemCount: descriptor.bgItemsCount()
            });
    }

    function getRandomness(uint256 wizardId) internal view returns (uint256) {
        uint256 pseudorandomness = uint256(
            keccak256(
                abi.encodePacked(
                    blockhash(block.number - 1),
                    wizardId,
                    block.difficulty,
                    block.coinbase
                )
            )
        );

        return pseudorandomness;
    }

    function getAccShift(uint256 wizardId) internal pure returns (uint256) {
        uint256 rem = wizardId % 2;
        uint256 shift = (rem == 0) ? 96 : 192;

        return shift;
    }

    function getClothShift(uint256 wizardId) internal pure returns (uint256) {
        uint256 rem = wizardId % 2;
        uint256 clothShift = (rem == 0) ? 48 : 144;

        return clothShift;
    }
}

File 2 of 3 : ISeeder.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for Seeder

pragma solidity ^0.8.6;

import { IDescriptor } from '../descriptor/IDescriptor.sol';

// "Skin", "Cloth", "Eye", "Mouth", "Acc", "Item", "Hat"
interface ISeeder {
    struct Seed {
        uint48 background;
        uint48 skin;
        uint48 clothes;
        uint48 eyes;
        uint48 mouth;
        uint48 accessory;
        uint48 bgItem;
        uint48 hat;
        bool oneOfOne;
        uint48 oneOfOneIndex;
    }

    function generateSeed(uint256 wizardId, IDescriptor descriptor, bool isOneOfOne, uint48 isOneOfOneIndex) external view returns (Seed memory);
}

File 3 of 3 : IDescriptor.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for Descriptor

pragma solidity ^0.8.6;

import { ISeeder } from '../seeder/ISeeder.sol';

interface IDescriptor {
    event PartsLocked();

    event DataURIToggled(bool enabled);

    event BaseURIUpdated(string baseURI);

    function arePartsLocked() external returns (bool);

    function isDataURIEnabled() external returns (bool);    

    function baseURI() external returns (string memory);

    function palettes(uint8 paletteIndex, uint256 colorIndex) external view returns (string memory);

    function addManyColorsToPalette(uint8 paletteIndex, string[] calldata newColors) external;

    function addColorToPalette(uint8 paletteIndex, string calldata color) external;


    function backgrounds(uint256 index) external view returns (string memory);    

    function backgroundCount() external view returns (uint256);

    function addManyBackgrounds(string[] calldata backgrounds) external;

    function addBackground(string calldata background) external;    

    
    
    function oneOfOnes(uint256 index) external view returns (bytes memory);

    function oneOfOnesCount() external view returns (uint256);

    function addOneOfOne(bytes calldata _oneOfOne) external;

    function addManyOneOfOnes(bytes[] calldata _oneOfOnes) external;    


    function skins(uint256 index) external view returns (bytes memory);

    function skinsCount() external view returns (uint256);

    function addManySkins(bytes[] calldata skins) external;

    function addSkin(bytes calldata skin) external;


    function hats(uint256 index) external view returns (bytes memory);

    function hatsCount() external view returns (uint256);

    function addManyHats(bytes[] calldata hats) external;

    function addHat(bytes calldata hat) external;

    
    function clothes(uint256 index) external view returns (bytes memory);

    function clothesCount() external view returns (uint256);

    function addManyClothes(bytes[] calldata ears) external;

    function addClothes(bytes calldata ear) external;


    function mouths(uint256 index) external view returns (bytes memory);

    function mouthsCount() external view returns (uint256);

    function addManyMouths(bytes[] calldata mouths) external;

    function addMouth(bytes calldata mouth) external;

    
    function eyes(uint256 index) external view returns (bytes memory);

    function eyesCount() external view returns (uint256);

    function addManyEyes(bytes[] calldata eyes) external;

    function addEyes(bytes calldata eye) external;


    function accessory(uint256 index) external view returns (bytes memory);

    function accessoryCount() external view returns (uint256);

    function addManyAccessories(bytes[] calldata noses) external;

    function addAccessory(bytes calldata nose) external;


    function bgItems(uint256 index) external view returns (bytes memory);

    function bgItemsCount() external view returns (uint256);

    function addManyBgItems(bytes[] calldata noses) external;

    function addBgItem(bytes calldata nose) external;


    function lockParts() external;

    function toggleDataURIEnabled() external;

    function setBaseURI(string calldata baseURI) external;

    function tokenURI(uint256 tokenId, ISeeder.Seed memory seed) external view returns (string memory);

    function dataURI(uint256 tokenId, ISeeder.Seed memory seed) external view returns (string memory);

    function genericDataURI(
        string calldata name,
        string calldata description,
        ISeeder.Seed memory seed
    ) external view returns (string memory);

    function generateSVGImage(ISeeder.Seed memory seed) external view returns (string memory);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"wizardId","type":"uint256"},{"internalType":"contract IDescriptor","name":"descriptor","type":"address"},{"internalType":"bool","name":"isOneOfOne","type":"bool"},{"internalType":"uint48","name":"oneOfOneIndex","type":"uint48"}],"name":"generateSeed","outputs":[{"components":[{"internalType":"uint48","name":"background","type":"uint48"},{"internalType":"uint48","name":"skin","type":"uint48"},{"internalType":"uint48","name":"clothes","type":"uint48"},{"internalType":"uint48","name":"eyes","type":"uint48"},{"internalType":"uint48","name":"mouth","type":"uint48"},{"internalType":"uint48","name":"accessory","type":"uint48"},{"internalType":"uint48","name":"bgItem","type":"uint48"},{"internalType":"uint48","name":"hat","type":"uint48"},{"internalType":"bool","name":"oneOfOne","type":"bool"},{"internalType":"uint48","name":"oneOfOneIndex","type":"uint48"}],"internalType":"struct ISeeder.Seed","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50610a3c806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806366438bc214610030575b600080fd5b61004361003e366004610823565b610059565b604051610050919061089f565b60405180910390f35b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810191909152821561010f57506040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915282151561010082015265ffffffffffff82166101208201526102ab565b600061011a866102b3565b9050600061012786610345565b90506000610134886107b4565b90506000610141896107e1565b905060405180610140016040528084600001518665ffffffffffff1661016791906109cb565b65ffffffffffff1681526020018460200151603087901c65ffffffffffff1661019091906109cb565b65ffffffffffff1681526020018460a001518387901c65ffffffffffff166101b891906109cb565b65ffffffffffff168152602001846060015160c087901c65ffffffffffff166101e191906109cb565b65ffffffffffff1681526020018460400151609087901c65ffffffffffff1661020a91906109cb565b65ffffffffffff1681526020018460c001518487901c65ffffffffffff1661023291906109cb565b65ffffffffffff1681526020018460e001518487901c65ffffffffffff1661025a91906109cb565b65ffffffffffff1681526020018460800151609087901c65ffffffffffff1661028391906109cb565b65ffffffffffff16815260200188151581526020018765ffffffffffff168152509450505050505b949350505050565b6000806102c160014361098d565b604080519140602083015281018490524460608083019190915241901b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166080820152609401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209392505050565b61038d60405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518061010001604052808373ffffffffffffffffffffffffffffffffffffffff16634531c0a86040518163ffffffff1660e01b815260040160206040518083038186803b1580156103df57600080fd5b505afa1580156103f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610417919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663ad1a4c3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561046257600080fd5b505afa158015610476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16630de518666040518163ffffffff1660e01b815260040160206040518083038186803b1580156104e557600080fd5b505afa1580156104f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051d919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16638104468c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561056857600080fd5b505afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a0919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663fcbc920c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105eb57600080fd5b505afa1580156105ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610623919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16632c6be7cb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a6919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16634daebac26040518163ffffffff1660e01b815260040160206040518083038186803b1580156106f157600080fd5b505afa158015610705573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610729919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16636b4311576040518163ffffffff1660e01b815260040160206040518083038186803b15801561077457600080fd5b505afa158015610788573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ac919061080a565b905292915050565b6000806107c26002846109cb565b9050600081156107d35760c06107d6565b60605b60ff16949350505050565b6000806107ef6002846109cb565b9050600081156108005760906107d6565b5060309392505050565b60006020828403121561081c57600080fd5b5051919050565b6000806000806080858703121561083957600080fd5b84359350602085013573ffffffffffffffffffffffffffffffffffffffff8116811461086457600080fd5b92506040850135801515811461087957600080fd5b9150606085013565ffffffffffff8116811461089457600080fd5b939692955090935050565b815165ffffffffffff168152610140810160208301516108c9602084018265ffffffffffff169052565b5060408301516108e3604084018265ffffffffffff169052565b5060608301516108fd606084018265ffffffffffff169052565b506080830151610917608084018265ffffffffffff169052565b5060a083015161093160a084018265ffffffffffff169052565b5060c083015161094b60c084018265ffffffffffff169052565b5060e083015161096560e084018265ffffffffffff169052565b50610100838101511515908301526101209283015165ffffffffffff16929091019190915290565b6000828210156109c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b600082610a01577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50069056fea26469706673582212201c6f154da0295b38b0a073e398e15ed9a5964558227aacb2f6de4969055c083564736f6c63430008060033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806366438bc214610030575b600080fd5b61004361003e366004610823565b610059565b604051610050919061089f565b60405180910390f35b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810191909152821561010f57506040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915282151561010082015265ffffffffffff82166101208201526102ab565b600061011a866102b3565b9050600061012786610345565b90506000610134886107b4565b90506000610141896107e1565b905060405180610140016040528084600001518665ffffffffffff1661016791906109cb565b65ffffffffffff1681526020018460200151603087901c65ffffffffffff1661019091906109cb565b65ffffffffffff1681526020018460a001518387901c65ffffffffffff166101b891906109cb565b65ffffffffffff168152602001846060015160c087901c65ffffffffffff166101e191906109cb565b65ffffffffffff1681526020018460400151609087901c65ffffffffffff1661020a91906109cb565b65ffffffffffff1681526020018460c001518487901c65ffffffffffff1661023291906109cb565b65ffffffffffff1681526020018460e001518487901c65ffffffffffff1661025a91906109cb565b65ffffffffffff1681526020018460800151609087901c65ffffffffffff1661028391906109cb565b65ffffffffffff16815260200188151581526020018765ffffffffffff168152509450505050505b949350505050565b6000806102c160014361098d565b604080519140602083015281018490524460608083019190915241901b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166080820152609401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209392505050565b61038d60405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518061010001604052808373ffffffffffffffffffffffffffffffffffffffff16634531c0a86040518163ffffffff1660e01b815260040160206040518083038186803b1580156103df57600080fd5b505afa1580156103f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610417919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663ad1a4c3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561046257600080fd5b505afa158015610476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16630de518666040518163ffffffff1660e01b815260040160206040518083038186803b1580156104e557600080fd5b505afa1580156104f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051d919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16638104468c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561056857600080fd5b505afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a0919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663fcbc920c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105eb57600080fd5b505afa1580156105ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610623919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16632c6be7cb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a6919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16634daebac26040518163ffffffff1660e01b815260040160206040518083038186803b1580156106f157600080fd5b505afa158015610705573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610729919061080a565b81526020018373ffffffffffffffffffffffffffffffffffffffff16636b4311576040518163ffffffff1660e01b815260040160206040518083038186803b15801561077457600080fd5b505afa158015610788573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ac919061080a565b905292915050565b6000806107c26002846109cb565b9050600081156107d35760c06107d6565b60605b60ff16949350505050565b6000806107ef6002846109cb565b9050600081156108005760906107d6565b5060309392505050565b60006020828403121561081c57600080fd5b5051919050565b6000806000806080858703121561083957600080fd5b84359350602085013573ffffffffffffffffffffffffffffffffffffffff8116811461086457600080fd5b92506040850135801515811461087957600080fd5b9150606085013565ffffffffffff8116811461089457600080fd5b939692955090935050565b815165ffffffffffff168152610140810160208301516108c9602084018265ffffffffffff169052565b5060408301516108e3604084018265ffffffffffff169052565b5060608301516108fd606084018265ffffffffffff169052565b506080830151610917608084018265ffffffffffff169052565b5060a083015161093160a084018265ffffffffffff169052565b5060c083015161094b60c084018265ffffffffffff169052565b5060e083015161096560e084018265ffffffffffff169052565b50610100838101511515908301526101209283015165ffffffffffff16929091019190915290565b6000828210156109c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b600082610a01577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50069056fea26469706673582212201c6f154da0295b38b0a073e398e15ed9a5964558227aacb2f6de4969055c083564736f6c63430008060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.