Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
10786169 | 428 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PseudoRandomizer
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 2 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {IPseudoRandomizer} from "src/interfaces/IPseudoRandomizer.sol"; import {ISeedConsumer} from "src/interfaces/ISeedConsumer.sol"; /** * @title PseudoRandomizer * @author fx(hash) * @dev See the documentation in {IPseudoRandomizer} */ contract PseudoRandomizer is IPseudoRandomizer { /*////////////////////////////////////////////////////////////////////////// EXTERNAL FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ /** * @inheritdoc IPseudoRandomizer */ function requestRandomness(uint256 _tokenId) external { bytes32 seed = generateSeed(_tokenId); ISeedConsumer(msg.sender).fulfillSeedRequest(_tokenId, seed); } /*////////////////////////////////////////////////////////////////////////// PUBLIC FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ /** * @inheritdoc IPseudoRandomizer */ function generateSeed(uint256 _tokenId) public view returns (bytes32) { return keccak256(abi.encodePacked(_tokenId, msg.sender, block.number, blockhash(block.number - 1))); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {IRandomizer} from "src/interfaces/IRandomizer.sol"; /** * @title IPseudoRandomizer * @author fx(hash) * @notice Randomizer for generating psuedorandom seeds for newly minted tokens */ interface IPseudoRandomizer is IRandomizer { /*////////////////////////////////////////////////////////////////////////// FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ /** * @notice Generates random seed for token using entropy * @param _tokenId ID of the token * @return Hash of the seed */ function generateSeed(uint256 _tokenId) external view returns (bytes32); /** * @inheritdoc IRandomizer */ function requestRandomness(uint256 _tokenId) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * @title ISeedConsumer * @author fx(hash) * @notice Interface for randomizers to interact with FxGenArt721 tokens */ interface ISeedConsumer { /*////////////////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////////////////*/ /** * @notice Event emitted when a seed request is fulfilled for a specific token * @param _randomizer Address of the randomizer contract * @param _tokenId ID of the token * @param _seed Hash of the random seed */ event SeedFulfilled(address indexed _randomizer, uint256 indexed _tokenId, bytes32 _seed); /*////////////////////////////////////////////////////////////////////////// FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ /** * @notice Fullfills the random seed request on the FxGenArt721 token contract * @param _tokenId ID of the token * @param _seed Hash of the random seed */ function fulfillSeedRequest(uint256 _tokenId, bytes32 _seed) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * @title IRandomizer * @author fx(hash) * @notice Interface for FxGenArt721 tokens to interact with randomizers */ interface IRandomizer { /*////////////////////////////////////////////////////////////////////////// FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ /** * @notice Requests random seed for a given token * @param _tokenId ID of the token */ function requestRandomness(uint256 _tokenId) external; }
{ "remappings": [ "openzeppelin/=lib/openzeppelin-contracts/", "openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "forge-std/=lib/forge-std/src/", "scripty.sol/=lib/scripty.sol/", "solady/=lib/solady/", "solmate/=lib/solmate/", "sstore2/=lib/sstore2/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 2 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"generateSeed","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"requestRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506101b9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063424611c31461003b5780637363ae1f14610060575b600080fd5b61004e610049366004610143565b610075565b60405190815260200160405180910390f35b61007361006e366004610143565b6100d9565b005b600081334361008560018261015c565b406040516020016100bc949392919093845260609290921b6001600160601b03191660208401526034830152605482015260740190565b604051602081830303815290604052805190602001209050919050565b60006100e482610075565b604051630d2789d360e41b81526004810184905260248101829052909150339063d2789d3090604401600060405180830381600087803b15801561012757600080fd5b505af115801561013b573d6000803e3d6000fd5b505050505050565b60006020828403121561015557600080fd5b5035919050565b8181038181111561017d57634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220559f2f7a98f93cd8e4ac0811fae0ce60104d86af848f88475edb94499f647d0b64736f6c63430008170033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063424611c31461003b5780637363ae1f14610060575b600080fd5b61004e610049366004610143565b610075565b60405190815260200160405180910390f35b61007361006e366004610143565b6100d9565b005b600081334361008560018261015c565b406040516020016100bc949392919093845260609290921b6001600160601b03191660208401526034830152605482015260740190565b604051602081830303815290604052805190602001209050919050565b60006100e482610075565b604051630d2789d360e41b81526004810184905260248101829052909150339063d2789d3090604401600060405180830381600087803b15801561012757600080fd5b505af115801561013b573d6000803e3d6000fd5b505050505050565b60006020828403121561015557600080fd5b5035919050565b8181038181111561017d57634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220559f2f7a98f93cd8e4ac0811fae0ce60104d86af848f88475edb94499f647d0b64736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
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.