ETH Price: $3,061.35 (-4.17%)
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x0992bb16...3327b5B10
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
SignatureVerifier

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: MIT

pragma solidity 0.8.26;
import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import { ISignatureVerifier } from "../interfaces/ISignatureVerifier.sol";

/**
 * @notice Implementation is generic. Deploy as a separate contract to be used with multiple Smart Contracts.
 * @title SignatureVerifier Smart Contract.
 * @dev Verifies signatures.
 */
contract SignatureVerifier is ISignatureVerifier {
  /**
   * @dev Verifies signature was signed by provided address's pk.
   * @param expectedSigner Expected signature signer.
   * @param messageHash Message hash.
   * @param signature Message signature.
   * @return Whether valid or not.
   */
  function verifySignature(
    address expectedSigner,
    bytes32 messageHash,
    bytes memory signature
  ) external view returns (bool) {
    bytes32 ethSignedMessageHash = _getEthSignedMessageHash(messageHash);

    return SignatureChecker.isValidSignatureNow(expectedSigner, ethSignedMessageHash, signature);
  }

  /**
   * @dev Creates signed message hash.
   * @param messageHash Message hash.
   * @return Signed message hash.
   */
  function _getEthSignedMessageHash(bytes32 messageHash) private pure returns (bytes32) {
    return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", messageHash));
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1271.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(
        bytes32 hash,
        bytes memory signature
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly ("memory-safe") {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/SignatureChecker.sol)

pragma solidity ^0.8.20;

import {ECDSA} from "./ECDSA.sol";
import {IERC1271} from "../../interfaces/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC-1271 signatures from smart contract wallets like
 * Argent and Safe Wallet (previously Gnosis Safe).
 */
library SignatureChecker {
    /**
     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
     * signature is validated against that smart contract using ERC-1271, otherwise it's validated using `ECDSA.recover`.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
        if (signer.code.length == 0) {
            (address recovered, ECDSA.RecoverError err, ) = ECDSA.tryRecover(hash, signature);
            return err == ECDSA.RecoverError.NoError && recovered == signer;
        } else {
            return isValidERC1271SignatureNow(signer, hash, signature);
        }
    }

    /**
     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
     * against the signer smart contract using ERC-1271.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidERC1271SignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeCall(IERC1271.isValidSignature, (hash, signature))
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
    }
}

File 5 of 5 : ISignatureVerifier.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

/*
 * @dev Interface for SignatureVerifier Smart Contract.
 */
interface ISignatureVerifier {
  function verifySignature(
    address _expectedSigner,
    bytes32 _messageHash,
    bytes memory _signature
  ) external view returns (bool);
}

Settings
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 200,
    "details": {
      "yulDetails": {
        "optimizerSteps": "u"
      }
    }
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"expectedSigner","type":"address"},{"internalType":"bytes32","name":"messageHash","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"verifySignature","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

0x60806040523460195760405161061061001f823961061090f35b600080fdfe6080604052600436101561001257600080fd5b60003560e01c63017519980361004857610179565b6001600160a01b031690565b90565b6001600160a01b0381165b0361004857565b600080fd5b9050359061005a82610036565b565b80610041565b9050359061005a8261005c565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff8211176100a757604052565b61006f565b9061005a6100b960405190565b9283610085565b67ffffffffffffffff81116100a757602090601f01601f19160190565b0190565b90826000939282370152565b909291926101026100fd826100c0565b6100ac565b93818552818301116100485761005a9160208501906100e1565b9080601f8301121561004857816020610033933591016100ed565b916060838303126100485761014c828461004d565b9261015a8360208301610062565b92604082013567ffffffffffffffff811161004857610033920161011c565b34610048576101a761019561018f366004610137565b916101ab565b60405191829182901515815260200190565b0390f35b6101c161003393926101bb600090565b506101ff565b90610279565b906100dd6101fa6020937f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c0190565b918252565b61022761020b60405190565b809261021b6020830191826101c7565b90810382520382610085565b610239610232825190565b9160200190565b2090565b6100336100336100339290565b634e487b7160e01b600052602160045260246000fd5b6004111561026a57565b61024a565b9061005a82610260565b9190823b61028e61028a600061023d565b9190565b036102d3579061029d9161045d565b506102b16102ab600061026f565b9161026f565b1491826102bd57505090565b6001600160a01b039081169250161490565b1490565b61003392610398565b60005b8381106102ef5750506000910152565b81810151838201526020016102df565b6103206103296020936100dd93610314815190565b80835293849260200190565b958691016102dc565b601f01601f191690565b908152604060208201819052610033929101906102ff565b906101fa6100fd836100c0565b3d15610372576103673d61034b565b903d6000602084013e565b606090565b9050519061005a8261005c565b906020828203126100485761003391610377565b916000926103de84936103a9600090565b506103cf6103b660405190565b630b135d3f60e11b602082015294859260248401610333565b60208201810382520383610085565b602082519201905afa6103ef610358565b81610428575b816103fe575090565b6104189150602061040d825190565b818301019101610384565b6102cf630b135d3f60e11b61028a565b9050610432815190565b61043f61028a602061023d565b1015906103f5565b6100276100336100339290565b61003390610447565b90600091610469825190565b61047661028a604161023d565b036104a05761049992506020820151906060604084015193015160001a9061050e565b9192909190565b5090506104bd6104b86104b36000610454565b925190565b61023d565b909160029190565b6100339061023d565b6104fe61005a946104f76060949897956104ed608086019a6000870152565b60ff166020850152565b6040830152565b0152565b6040513d6000823e3d90fd5b9091610519846104c5565b61054561028a7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a061023d565b116105c657906105676020946000949361055e60405190565b948594856104ce565b838052039060015afa156105c15760005160009161058483610454565b6001600160a01b0381166001600160a01b038416146105ad57506105a78361023d565b91929190565b9150916105b99061023d565b909160019190565b610502565b5050506105d36000610454565b916003919056fea2646970667358221220246881e47360b07b96098447592fc3b1370b46a0adcada58a738b479cf60bb8b64736f6c634300081a0033

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c63017519980361004857610179565b6001600160a01b031690565b90565b6001600160a01b0381165b0361004857565b600080fd5b9050359061005a82610036565b565b80610041565b9050359061005a8261005c565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff8211176100a757604052565b61006f565b9061005a6100b960405190565b9283610085565b67ffffffffffffffff81116100a757602090601f01601f19160190565b0190565b90826000939282370152565b909291926101026100fd826100c0565b6100ac565b93818552818301116100485761005a9160208501906100e1565b9080601f8301121561004857816020610033933591016100ed565b916060838303126100485761014c828461004d565b9261015a8360208301610062565b92604082013567ffffffffffffffff811161004857610033920161011c565b34610048576101a761019561018f366004610137565b916101ab565b60405191829182901515815260200190565b0390f35b6101c161003393926101bb600090565b506101ff565b90610279565b906100dd6101fa6020937f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c0190565b918252565b61022761020b60405190565b809261021b6020830191826101c7565b90810382520382610085565b610239610232825190565b9160200190565b2090565b6100336100336100339290565b634e487b7160e01b600052602160045260246000fd5b6004111561026a57565b61024a565b9061005a82610260565b9190823b61028e61028a600061023d565b9190565b036102d3579061029d9161045d565b506102b16102ab600061026f565b9161026f565b1491826102bd57505090565b6001600160a01b039081169250161490565b1490565b61003392610398565b60005b8381106102ef5750506000910152565b81810151838201526020016102df565b6103206103296020936100dd93610314815190565b80835293849260200190565b958691016102dc565b601f01601f191690565b908152604060208201819052610033929101906102ff565b906101fa6100fd836100c0565b3d15610372576103673d61034b565b903d6000602084013e565b606090565b9050519061005a8261005c565b906020828203126100485761003391610377565b916000926103de84936103a9600090565b506103cf6103b660405190565b630b135d3f60e11b602082015294859260248401610333565b60208201810382520383610085565b602082519201905afa6103ef610358565b81610428575b816103fe575090565b6104189150602061040d825190565b818301019101610384565b6102cf630b135d3f60e11b61028a565b9050610432815190565b61043f61028a602061023d565b1015906103f5565b6100276100336100339290565b61003390610447565b90600091610469825190565b61047661028a604161023d565b036104a05761049992506020820151906060604084015193015160001a9061050e565b9192909190565b5090506104bd6104b86104b36000610454565b925190565b61023d565b909160029190565b6100339061023d565b6104fe61005a946104f76060949897956104ed608086019a6000870152565b60ff166020850152565b6040830152565b0152565b6040513d6000823e3d90fd5b9091610519846104c5565b61054561028a7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a061023d565b116105c657906105676020946000949361055e60405190565b948594856104ce565b838052039060015afa156105c15760005160009161058483610454565b6001600160a01b0381166001600160a01b038416146105ad57506105a78361023d565b91929190565b9150916105b99061023d565b909160019190565b610502565b5050506105d36000610454565b916003919056fea2646970667358221220246881e47360b07b96098447592fc3b1370b46a0adcada58a738b479cf60bb8b64736f6c634300081a0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
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.