ETH Price: $3,374.91 (+3.19%)
Gas: 5.83 Gwei
 

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

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block
From
To
186182012023-11-21 5:57:11437 days ago1700546231  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NFTMetadataRouterExtension

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 6 : NFTMetadataRouterExtension.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Extension} from "0xrails/extension/Extension.sol";
import {NFTMetadataRouter} from "./NFTMetadataRouter.sol";

contract NFTMetadataRouterExtension is NFTMetadataRouter, Extension {
    /*=======================
        CONTRACT METADATA
    =======================*/

    constructor(address router) Extension() NFTMetadataRouter(router) {}

    function _contractRoute() internal pure override returns (string memory route) {
        return "extension";
    }

    /*===============
        EXTENSION
    ===============*/

    /// @inheritdoc Extension
    function getAllSelectors() public pure override returns (bytes4[] memory selectors) {
        selectors = new bytes4[](2);
        selectors[0] = this.ext_contractURI.selector;
        selectors[1] = this.ext_tokenURI.selector;
        return selectors;
    }

    /// @inheritdoc Extension
    function signatureOf(bytes4 selector) public pure override returns (string memory) {
        if (selector == this.ext_contractURI.selector) {
            return "ext_contractURI()";
        } else if (selector == this.ext_tokenURI.selector) {
            return "ext_tokenURI(uint256)";
        } else {
            return "";
        }
    }
}

File 2 of 6 : Extension.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {IExtension} from "./interface/IExtension.sol";

abstract contract Extension is IExtension {
    constructor() {
        getAllSignatures(); // verify selectors properly synced
    }

    /// @inheritdoc IExtension
    function signatureOf(bytes4 selector) public pure virtual returns (string memory signature) {}

    /// @inheritdoc IExtension
    function getAllSelectors() public pure virtual returns (bytes4[] memory selectors) {}

    /// @inheritdoc IExtension
    function getAllSignatures() public pure returns (string[] memory signatures) {
        bytes4[] memory selectors = getAllSelectors();
        uint256 len = selectors.length;
        signatures = new string[](len);
        for (uint256 i; i < len; i++) {
            bytes4 selector = selectors[i];
            string memory signature = signatureOf(selector);
            require(bytes4(keccak256(abi.encodePacked(signature))) == selector, "SELECTOR_SIGNATURE_MISMATCH");
            signatures[i] = signature;
        }
    }
}

File 3 of 6 : NFTMetadataRouter.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {INFTMetadata} from "./INFTMetadata.sol";
import {IMetadataRouter} from "../../../metadataRouter/IMetadataRouter.sol";

contract NFTMetadataRouter is INFTMetadata {
    address public immutable metadataRouter;

    constructor(address _metadataRouter) {
        metadataRouter = _metadataRouter;
    }

    /// @dev Returns the contract URI for this contract, a modern standard for NFTs
    /// @notice Intended to be invoked in the context of a delegatecall
    function contractURI() public view virtual returns (string memory uri) {
        return IMetadataRouter(metadataRouter).uriOf(_contractRoute(), address(this));
    }

    function _contractRoute() internal pure virtual returns (string memory route) {
        return "contract";
    }

    /*===========
        VIEWS
    ===========*/

    /// @inheritdoc INFTMetadata
    function ext_contractURI() external view returns (string memory uri) {
        return IMetadataRouter(metadataRouter).uriOf("collection", address(this));
    }

    /// @inheritdoc INFTMetadata
    function ext_tokenURI(uint256 tokenId) external view returns (string memory uri) {
        return IMetadataRouter(metadataRouter).tokenURI(address(this), tokenId);
    }
}

File 4 of 6 : IExtension.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

interface IExtension {
    /// @dev Function to get the signature string for a specific function selector.
    /// @param selector The function selector to query.
    /// @return signature The signature string for the given function.
    function signatureOf(bytes4 selector) external pure returns (string memory signature);

    /// @dev Function to get an array of all recognized function selectors.
    /// @return selectors An array containing all 4-byte function selectors.
    function getAllSelectors() external pure returns (bytes4[] memory selectors);

    /// @dev Function to get an array of all recognized function signature strings.
    /// @return signatures An array containing all function signature strings.
    function getAllSignatures() external pure returns (string[] memory signatures);
}

File 5 of 6 : INFTMetadata.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

interface INFTMetadata {
    /// @dev Function to extend the `contractURI()` function
    /// @notice Intended to be invoked in the context of a delegatecall
    function ext_contractURI() external view returns (string memory uri);

    /// @dev Function to extend the `tokenURI()` function
    /// @notice Intended to be invoked in the context of a delegatecall
    function ext_tokenURI(uint256 tokenId) external view returns (string memory uri);
}

File 6 of 6 : IMetadataRouter.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

interface IMetadataRouter {
    // events
    event DefaultURIUpdated(string uri);
    event RouteURIUpdated(string route, string uri);
    event ContractRouteURIUpdated(string route, string uri, address indexed contractAddress);

    /// @dev Get the base URI for a specific route and contract address.
    /// @param route The name of the route.
    /// @param contractAddress The address of the contract for which to request a URI.
    /// @return '' The base URI for the specified route and contract address.
    /// @notice If a route-specific URI is not configured for the contract address, the default URI will be used.
    function baseURI(string memory route, address contractAddress) external view returns (string memory);

    /// @dev Get the default URI for cases where no specific URI is configured.
    /// @return '' The default URI.
    function defaultURI() external view returns (string memory);

    /// @dev Get the URI for the MetadataRouter contract itself.
    /// @return uri The URI for the MetadataRouter contract.
    function contractURI() external view returns (string memory uri);

    /// @dev Get the URI configured for a specific route.
    /// @param route The name of the route.
    /// @return uri The URI configured for the specified route.
    function routeURI(string memory route) external view returns (string memory);

    /// @dev Get the URI configured for a specific route and contract address.
    /// @param route The name of the route.
    /// @param contractAddress The address of the contract for which to request a URI.
    /// @return '' The URI configured for the specified route and contract address.
    function contractRouteURI(string memory route, address contractAddress) external view returns (string memory);

    /// @dev Get the full URI for a specific route and contract address.
    /// @param route The name of the route.
    /// @param contractAddress The address of the contract for which to request a URI.
    /// @return '' The full URI for the specified route and contract address.
    function uriOf(string memory route, address contractAddress) external view returns (string memory);

    /// @dev Get the full URI for a specific route and contract address, with additional appended data.
    /// @param route The name of the route.
    /// @param contractAddress The address of the contract for which the URI is requested.
    /// @param appendData Additional data to append to the URI.
    /// @return '' The full URI with appended data for the specified route and contract address.
    function uriOf(string memory route, address contractAddress, string memory appendData)
        external
        view
        returns (string memory);

    /// @dev Get the token URI for an NFT tokenId within a specific collection.
    /// @param collection The address of the NFT collection contract.
    /// @param tokenId The ID of the NFT token within the collection.
    /// @return '' The token URI for the specified NFT token.
    function tokenURI(address collection, uint256 tokenId) external view returns (string memory);

    /// @dev Set the default URI to be used when no specific URI is configured.
    /// @param uri The new default URI.
    /// @notice Only the contract owner can set the default URI.
    function setDefaultURI(string memory uri) external;

    /// @dev Set the URI for a specific route.
    /// @param uri The new URI to be configured for the route.
    /// @param route The name of the route.
    /// @notice Only the contract owner can set route-specific URIs.
    function setRouteURI(string memory uri, string memory route) external;

    /// @dev Set the URI for a specific route and contract address.
    /// @param uri The new URI to be configured for the route and contract address.
    /// @param route The name of the route.
    /// @param contractAddress The address of the contract for which the URI is configured.
    /// @notice Only the contract owner can set contract-specific URIs.
    function setContractRouteURI(string memory uri, string memory route, address contractAddress) external;
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "test/=test/",
    "0xrails/=lib/0xrails/src/",
    "ERC721A/=lib/0xrails/lib/ERC721A/contracts/",
    "erc4626-tests/=lib/0xrails/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "erc6551/=lib/0xrails/lib/erc6551/src/",
    "openzeppelin/=lib/0xrails/lib/openzeppelin-contracts/contracts/",
    "protocol-ops/=lib/protocol-ops/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ext_contractURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ext_tokenURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllSelectors","outputs":[{"internalType":"bytes4[]","name":"selectors","type":"bytes4[]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getAllSignatures","outputs":[{"internalType":"string[]","name":"signatures","type":"string[]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"metadataRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"signatureOf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]

60a06040523480156200001157600080fd5b5060405162000c5a38038062000c5a83398101604081905262000034916200030c565b6001600160a01b0381166080526200004b62000053565b5050620003c3565b6060600062000061620001ca565b8051909150806001600160401b038111156200008157620000816200033e565b604051908082528060200260200182016040528015620000b657816020015b6060815260200190600190039081620000a05790505b50925060005b81811015620001c4576000838281518110620000dc57620000dc62000354565b602002602001015190506000620000f9826200025e60201b60201c565b9050816001600160e01b031916816040516020016200011991906200036a565b604051602081830303815290604052805190602001206001600160e01b031916146200018b5760405162461bcd60e51b815260206004820152601b60248201527f53454c4543544f525f5349474e41545552455f4d49534d415443480000000000604482015260640160405180910390fd5b80868481518110620001a157620001a162000354565b602002602001018190525050508080620001bb906200039b565b915050620000bc565b50505090565b6040805160028082526060808301845292602083019080368337019050509050638638c44960e01b8160008151811062000208576200020862000354565b6001600160e01b03199092166020928302919091019091015280516301cef28d60e21b908290600190811062000242576200024262000354565b6001600160e01b03199092166020928302919091019091015290565b60606379c73bb760e01b6001600160e01b0319831601620002a65750506040805180820190915260118152706578745f636f6e7472616374555249282960781b602082015290565b633e310d7360e21b6001600160e01b0319831601620002f857505060408051808201909152601581527f6578745f746f6b656e5552492875696e74323536290000000000000000000000602082015290565b505060408051602081019091526000815290565b6000602082840312156200031f57600080fd5b81516001600160a01b03811681146200033757600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000825160005b818110156200038d576020818601810151858301520162000371565b506000920191825250919050565b600060018201620003bc57634e487b7160e01b600052601160045260246000fd5b5060010190565b608051610867620003f36000396000818160f50152818161015601528181610340015261051d01526108676000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638638c4491161005b5780638638c449146100d3578063906b6d98146100db578063c8cf3c87146100f0578063e8a3d4851461012f57600080fd5b8063073bca34146100825780631e020af3146100ab57806371e259ed146100be575b600080fd5b61009561009036600461058e565b610137565b6040516100a291906105f7565b60405180910390f35b6100956100b9366004610611565b6101d3565b6100c6610277565b6040516100a2919061063b565b610095610305565b6100e36103bd565b6040516100a29190610689565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a2565b610095610519565b60405163e9dc637560e01b8152306004820152602481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e9dc637590604401600060405180830381865afa1580156101a5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101cd9190810190610701565b92915050565b60606379c73bb760e01b6001600160e01b031983160161021a5750506040805180820190915260118152706578745f636f6e7472616374555249282960781b602082015290565b633e310d7360e21b6001600160e01b03198316016102635750506040805180820190915260158152746578745f746f6b656e5552492875696e743235362960581b602082015290565b505060408051602081019091526000815290565b6040805160028082526060808301845292602083019080368337019050509050638638c44960e01b816000815181106102b2576102b26107ae565b6001600160e01b03199092166020928302919091019091015280516301cef28d60e21b90829060019081106102e9576102e96107ae565b6001600160e01b03199092166020928302919091019091015290565b604080516361620ce760e11b81526004810191909152600a60448201526931b7b63632b1ba34b7b760b11b60648201523060248201526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c2c419ce906084015b600060405180830381865afa158015610390573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103b89190810190610701565b905090565b606060006103c9610277565b80519091508067ffffffffffffffff8111156103e7576103e76106eb565b60405190808252806020026020018201604052801561041a57816020015b60608152602001906001900390816104055790505b50925060005b8181101561051357600083828151811061043c5761043c6107ae565b602002602001015190506000610451826101d3565b9050816001600160e01b0319168160405160200161046f91906107c4565b604051602081830303815290604052805190602001206001600160e01b031916146104e05760405162461bcd60e51b815260206004820152601b60248201527f53454c4543544f525f5349474e41545552455f4d49534d415443480000000000604482015260640160405180910390fd5b808684815181106104f3576104f36107ae565b60200260200101819052505050808061050b906107e0565b915050610420565b50505090565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c2c419ce61057060408051808201909152600981526832bc3a32b739b4b7b760b91b602082015290565b306040518363ffffffff1660e01b8152600401610373929190610807565b6000602082840312156105a057600080fd5b5035919050565b60005b838110156105c25781810151838201526020016105aa565b50506000910152565b600081518084526105e38160208601602086016105a7565b601f01601f19169290920160200192915050565b60208152600061060a60208301846105cb565b9392505050565b60006020828403121561062357600080fd5b81356001600160e01b03198116811461060a57600080fd5b6020808252825182820181905260009190848201906040850190845b8181101561067d5783516001600160e01b03191683529284019291840191600101610657565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156106de57603f198886030184526106cc8583516105cb565b945092850192908501906001016106b0565b5092979650505050505050565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561071357600080fd5b815167ffffffffffffffff8082111561072b57600080fd5b818401915084601f83011261073f57600080fd5b815181811115610751576107516106eb565b604051601f8201601f19908116603f01168101908382118183101715610779576107796106eb565b8160405282815287602084870101111561079257600080fd5b6107a38360208301602088016105a7565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b600082516107d68184602087016105a7565b9190910192915050565b60006001820161080057634e487b7160e01b600052601160045260246000fd5b5060010190565b60408152600061081a60408301856105cb565b905060018060a01b0383166020830152939250505056fea2646970667358221220fa5e0ac4b49e930c63cfa27d9b57276a0df8d6cae5c6409afc61d3320fc4a3a164736f6c63430008130033000000000000000000000000d875345db38a113f3dd8f766f57cbbd2c4c2ab99

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638638c4491161005b5780638638c449146100d3578063906b6d98146100db578063c8cf3c87146100f0578063e8a3d4851461012f57600080fd5b8063073bca34146100825780631e020af3146100ab57806371e259ed146100be575b600080fd5b61009561009036600461058e565b610137565b6040516100a291906105f7565b60405180910390f35b6100956100b9366004610611565b6101d3565b6100c6610277565b6040516100a2919061063b565b610095610305565b6100e36103bd565b6040516100a29190610689565b6101177f000000000000000000000000d875345db38a113f3dd8f766f57cbbd2c4c2ab9981565b6040516001600160a01b0390911681526020016100a2565b610095610519565b60405163e9dc637560e01b8152306004820152602481018290526060907f000000000000000000000000d875345db38a113f3dd8f766f57cbbd2c4c2ab996001600160a01b03169063e9dc637590604401600060405180830381865afa1580156101a5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101cd9190810190610701565b92915050565b60606379c73bb760e01b6001600160e01b031983160161021a5750506040805180820190915260118152706578745f636f6e7472616374555249282960781b602082015290565b633e310d7360e21b6001600160e01b03198316016102635750506040805180820190915260158152746578745f746f6b656e5552492875696e743235362960581b602082015290565b505060408051602081019091526000815290565b6040805160028082526060808301845292602083019080368337019050509050638638c44960e01b816000815181106102b2576102b26107ae565b6001600160e01b03199092166020928302919091019091015280516301cef28d60e21b90829060019081106102e9576102e96107ae565b6001600160e01b03199092166020928302919091019091015290565b604080516361620ce760e11b81526004810191909152600a60448201526931b7b63632b1ba34b7b760b11b60648201523060248201526060907f000000000000000000000000d875345db38a113f3dd8f766f57cbbd2c4c2ab996001600160a01b03169063c2c419ce906084015b600060405180830381865afa158015610390573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103b89190810190610701565b905090565b606060006103c9610277565b80519091508067ffffffffffffffff8111156103e7576103e76106eb565b60405190808252806020026020018201604052801561041a57816020015b60608152602001906001900390816104055790505b50925060005b8181101561051357600083828151811061043c5761043c6107ae565b602002602001015190506000610451826101d3565b9050816001600160e01b0319168160405160200161046f91906107c4565b604051602081830303815290604052805190602001206001600160e01b031916146104e05760405162461bcd60e51b815260206004820152601b60248201527f53454c4543544f525f5349474e41545552455f4d49534d415443480000000000604482015260640160405180910390fd5b808684815181106104f3576104f36107ae565b60200260200101819052505050808061050b906107e0565b915050610420565b50505090565b60607f000000000000000000000000d875345db38a113f3dd8f766f57cbbd2c4c2ab996001600160a01b031663c2c419ce61057060408051808201909152600981526832bc3a32b739b4b7b760b91b602082015290565b306040518363ffffffff1660e01b8152600401610373929190610807565b6000602082840312156105a057600080fd5b5035919050565b60005b838110156105c25781810151838201526020016105aa565b50506000910152565b600081518084526105e38160208601602086016105a7565b601f01601f19169290920160200192915050565b60208152600061060a60208301846105cb565b9392505050565b60006020828403121561062357600080fd5b81356001600160e01b03198116811461060a57600080fd5b6020808252825182820181905260009190848201906040850190845b8181101561067d5783516001600160e01b03191683529284019291840191600101610657565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156106de57603f198886030184526106cc8583516105cb565b945092850192908501906001016106b0565b5092979650505050505050565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561071357600080fd5b815167ffffffffffffffff8082111561072b57600080fd5b818401915084601f83011261073f57600080fd5b815181811115610751576107516106eb565b604051601f8201601f19908116603f01168101908382118183101715610779576107796106eb565b8160405282815287602084870101111561079257600080fd5b6107a38360208301602088016105a7565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b600082516107d68184602087016105a7565b9190910192915050565b60006001820161080057634e487b7160e01b600052601160045260246000fd5b5060010190565b60408152600061081a60408301856105cb565b905060018060a01b0383166020830152939250505056fea2646970667358221220fa5e0ac4b49e930c63cfa27d9b57276a0df8d6cae5c6409afc61d3320fc4a3a164736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000d875345db38a113f3dd8f766f57cbbd2c4c2ab99

-----Decoded View---------------
Arg [0] : router (address): 0xD875345Db38a113f3dd8F766F57cBbd2c4c2Ab99

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000d875345db38a113f3dd8f766f57cbbd2c4c2ab99


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
[ 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.