Sophon Testnet

Contract

0x6f080ddeF36770Ee3DC77376aa27807CDA1093BB

Overview

SOPH Balance

Sophon Sepolia  LogoSophon Sepolia  LogoSophon Sepolia  Logo0 SOPH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
881962024-11-28 18:31:2819 days ago1732818688  Contract Creation0 SOPH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SignatureChecker

Compiler Version
v0.6.12+commit.27d51765

ZkSolc Version
v1.3.19

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 3 : SignatureChecker.sol
/**
 * Copyright 2023 Circle Internet Group, Inc. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

pragma solidity 0.6.12;

import { ECRecover } from "./ECRecover.sol";
import { IERC1271 } from "../interface/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECRecover.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets.
 *
 * Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/21bb89ef5bfc789b9333eb05e3ba2b7b284ac77c/contracts/utils/cryptography/SignatureChecker.sol
 */
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 ERC1271, otherwise it's validated using `ECRecover.recover`.
     * @param signer        Address of the claimed signer
     * @param digest        Keccak-256 hash digest of the signed message
     * @param signature     Signature byte array associated with hash
     */
    function isValidSignatureNow(
        address signer,
        bytes32 digest,
        bytes memory signature
    ) external view returns (bool) {
        if (!isContract(signer)) {
            return ECRecover.recover(digest, signature) == signer;
        }
        return isValidERC1271SignatureNow(signer, digest, 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 ERC1271.
     * @param signer        Address of the claimed signer
     * @param digest        Keccak-256 hash digest of the signed message
     * @param signature     Signature byte array associated with hash
     *
     * 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 digest,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeWithSelector(
                IERC1271.isValidSignature.selector,
                digest,
                signature
            )
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) ==
            bytes32(IERC1271.isValidSignature.selector));
    }

    /**
     * @dev Checks if the input address is a smart contract.
     */
    function isContract(address addr) internal view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(addr)
        }
        return size > 0;
    }
}

File 2 of 3 : ECRecover.sol
/**
 * Copyright 2023 Circle Internet Group, Inc. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

pragma solidity 0.6.12;

/**
 * @title ECRecover
 * @notice A library that provides a safe ECDSA recovery function
 */
library ECRecover {
    /**
     * @notice Recover signer's address from a signed message
     * @dev Adapted from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/65e4ffde586ec89af3b7e9140bdc9235d1254853/contracts/cryptography/ECDSA.sol
     * Modifications: Accept v, r, and s as separate arguments
     * @param digest    Keccak-256 hash digest of the signed message
     * @param v         v of the signature
     * @param r         r of the signature
     * @param s         s of the signature
     * @return Signer address
     */
    function recover(
        bytes32 digest,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        // 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 (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): 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
        ) {
            revert("ECRecover: invalid signature 's' value");
        }

        if (v != 27 && v != 28) {
            revert("ECRecover: invalid signature 'v' value");
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(digest, v, r, s);
        require(signer != address(0), "ECRecover: invalid signature");

        return signer;
    }

    /**
     * @notice Recover signer's address from a signed message
     * @dev Adapted from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/0053ee040a7ff1dbc39691c9e67a69f564930a88/contracts/utils/cryptography/ECDSA.sol
     * @param digest    Keccak-256 hash digest of the signed message
     * @param signature Signature byte array associated with hash
     * @return Signer address
     */
    function recover(bytes32 digest, bytes memory signature)
        internal
        pure
        returns (address)
    {
        require(signature.length == 65, "ECRecover: invalid signature length");

        bytes32 r;
        bytes32 s;
        uint8 v;

        // ecrecover takes the signature parameters, and the only way to get them
        // currently is to use assembly.
        /// @solidity memory-safe-assembly
        assembly {
            r := mload(add(signature, 0x20))
            s := mload(add(signature, 0x40))
            v := byte(0, mload(add(signature, 0x60)))
        }
        return recover(digest, v, r, s);
    }
}

File 3 of 3 : IERC1271.sol
/**
 * Copyright 2023 Circle Internet Group, Inc. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

pragma solidity 0.6.12;

/**
 * @dev Interface of the ERC1271 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 the provided data hash
     * @return magicValue   bytes4 magic value 0x1626ba7e when function passes
     */
    function isValidSignature(bytes32 hash, bytes memory signature)
        external
        view
        returns (bytes4 magicValue);
}

Settings
{
  "viaIR": false,
  "codegen": "yul",
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@ensdomains/=node_modules/@ensdomains/",
    "@solidity-parser/=node_modules/prettier-plugin-solidity/node_modules/@solidity-parser/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "hardhat/=node_modules/hardhat/"
  ],
  "evmVersion": "istanbul",
  "outputSelection": {
    "*": {
      "*": [
        "abi"
      ]
    }
  },
  "optimizer": {
    "enabled": true,
    "mode": "3",
    "fallback_to_optimizing_for_size": false,
    "disable_system_request_memoization": true
  },
  "metadata": {},
  "libraries": {},
  "detectMissingLibraries": false,
  "enableEraVMExtensions": false,
  "forceEVMLA": false
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"bytes32","name":"digest","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"isValidSignatureNow","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

9c4d535b0000000000000000000000000000000000000000000000000000000000000000010000898bf3278181c9e7fe57f31ebc8709fe7ad0d5a4cf6ec011479fdf39d600000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x0002000000000002000400000000000200000000030100190000006003300270000000740330019700010000003103550000000102200190000000ce0000c13d0000008009000039000000400090043f000000030230008c000000dd0000a13d000000000201043b0000007802200197000000790220009c000000dd0000c13d000000640230008a000000600400008a000000000242004b000000dd0000813d0000002402100370000000000702043b0000000402100370000000000202043b0000007a082001970000004402100370000000000202043b0000007b0420009c000000dd0000213d0000002405200039000000000435004b000000dd0000213d0000000404200039000000000241034f000000000202043b0000007b0620009c000000dd0000213d0000000005520019000000000335004b000000dd0000213d000400000007001d000000bf032000390001002000000092000000010330017f000000400030043f0000002003400039000000000131034f0000001f0320018f000000800020043f00000005042002720000003c0000613d00000000050000190000000506500210000000000761034f000000000707043b000000a00660003900000000007604350000000105500039000000000645004b000000340000413d000200000009001d000000000503004b0000004c0000613d0000000504400210000000000141034f0000000303300210000000a004400039000000000504043300000000053501cf000000000535022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000151019f0000000000140435000000a00120003900000000000104350000007c010000410000000000100439000300000008001d000000040080044300000074010000410000000002000414000000740320009c0000000002018019000000c0012002100000007d011001c7000080020200003901c901c40000040f0000000102200190000000df0000613d000000400200043d000000000101043b000000000101004b000000e00000c13d000000800100043d000000410110008c00000004070000290000012a0000c13d000000a00100043d000000c00300043d000000830430009c000001880000813d000000e00400043d000000f8044002700000001b0540008a000000010550008c0000018e0000213d0000000005020436000000400050043f00000080062000390000000000360435000000600320003900000000001304350000004001200039000000000041043500000000007504350000007401000041000000400400043d000400000004001d000000740340009c0000000003010019000000000304401900000040033002100000000002420049000000a002200039000000740420009c00000000020180190000006002200210000000000232019f0000000003000414000000740430009c0000000003018019000000c001300210000000000112019f000000010200003901c901c40000040f0000000403000029000000200430008a000000000301001900000060033002700000007403300197000000200530008c000000000603001900000020060080390000001f0560018f00000005066002720000009e0000613d000000000700001900000005087002100000000009840019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000000960000413d000000000705004b000000ad0000613d0000000506600210000000000761034f00000000046400190000000305500210000000000604043300000000065601cf000000000656022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000565019f0000000000540435000000000003001f000100000001035500000001022001900000000304000029000001a80000613d000000400100043d000000200210008a00000000020204330000007a02200198000001760000c13d00000044021000390000008703000041000000000032043500000024021000390000001c03000039000000000032043500000082020000410000000000210435000000040210003900000020030000390000000000320435000000400200043d000000000121004900000064011000390000007403000041000000740410009c0000000001038019000000740420009c000000000203801900000040022002100000006001100210000000000121019f000001cb000104300000000b0100043d000000750110019700000076011001c70000000b0010043f000000000100041000000000001004350000000b0100043d000000750110019700000076011001c70000000b0010043f0000002001000039000001000010044300000120000004430000007701000041000001ca0001042e0000000001000019000001cb00010430000000000001042f0000004401200039000000400300003900000000003104350000002401200039000000040300002900000000003104350000006401200039000000800300043d00000000003104350000008401200039000000800600043d000000000306004b0000000302000029000001000000613d00000000030000190000000004130019000000a005300039000000000505043300000000005404350000002003300039000000000463004b000000ef0000413d00000000011600190000001f04600190000001000000613d0000000003410049000000030140021000000100051000890000000014030434000000000454022f00000000045401cf0000000000430435000000400500043d0000000003510049000000200330008a0000000004350436000000400010043f00000000010404330000007e011001970000007f061001c70000000000640435000000400100043d0000000007050433000000200370008c00000000050700190000000003010019000001170000413d0000000003010019000000000507001900000000460404340000000003630436000000200550008a000000200650008c000001110000813d000000000604043300000003045002100000010004400089000000010440020f000000000505004b00000000040060190000000005400049000000000556016f000000010440008a0000000006030433000000000464016f000000000454019f0000000000430435000000400400043d0000000003000414000000040520008c000001330000c13d00000001020000390000000005000031000001470000013d00000064012000390000008003000041000000000031043500000044012000390000008103000041000000000031043500000024012000390000002303000039000001960000013d000000000117001900000000014100490000007406000041000000740540009c00000000040680190000004004400210000000740510009c00000000010680190000006001100210000000000141019f000000740430009c0000000003068019000000c003300210000000000131019f01c901c40000040f000000010220018f00010000000103550000006001100270000000740010019d000000740510019700000002090000290000006001000039000000000305004b0000016d0000613d0000003f01500039000000010310017f000000400100043d0000000003310019000000400030043f0000001f0350018f0000000009510436000000010400036700000005055002720000015e0000613d000000000600001900000005076002100000000008790019000000000774034f000000000707043b00000000007804350000000106600039000000000756004b000001560000413d000000000603004b0000016d0000613d0000000505500210000000000454034f00000000055900190000000303300210000000000605043300000000063601cf000000000636022f000000000404043b0000010003300089000000000434022f00000000033401cf000000000363019f0000000000350435000000000202004b0000000002000019000001790000613d0000000001010433000000200110008c0000000002000019000001790000413d0000007f040000410000000002090433000000000142004b00000000020000190000000102006039000000010120018f000000400200043d0000000000120435000000400100043d000000000212004900000020022000390000007403000041000000740420009c0000000002038019000000740410009c000000000103801900000040011002100000006002200210000000000112019f000001ca0001042e00000064012000390000008403000041000000000031043500000044012000390000008503000041000001930000013d00000064012000390000008403000041000000000031043500000044012000390000008603000041000000000031043500000024012000390000002603000039000000000031043500000082010000410000000000120435000000040120003900000020030000390000000000310435000000400100043d000000000212004900000084022000390000007403000041000000740420009c0000000002038019000000740410009c000000000103801900000040011002100000006002200210000000000112019f000001cb000104300000001f0430018f0000000502300272000001b30000613d00000000050000190000000506500210000000000761034f000000000707043b00000000007604350000000105500039000000000625004b000001ac0000413d000000000504004b000001c10000613d00000003044002100000000502200210000000000502043300000000054501cf000000000545022f000000000121034f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001204350000006001300210000001cb00010430000000000001042f000001c7002104230000000102000039000000000001042d0000000002000019000000000001042d000001c900000432000001ca0001042e000001cb00010430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff73000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000040000001000000000000000000ffffffff000000000000000000000000000000000000000000000000000000006ccea65200000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000001000000001806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b83020000020000000000000000000000000000002400000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff1626ba7e00000000000000000000000000000000000000000000000000000000677468000000000000000000000000000000000000000000000000000000000045435265636f7665723a20696e76616c6964207369676e6174757265206c656e08c379a0000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a12076616c7565000000000000000000000000000000000000000000000000000045435265636f7665723a20696e76616c6964207369676e61747572652027732745435265636f7665723a20696e76616c6964207369676e61747572652027762745435265636f7665723a20696e76616c6964207369676e6174757265000000004523d4392bd96b72f34c0588377a4afbabe4b9f50ae33b24717e2e2a74965920

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