Source Code
Overview
SOPH Balance
0 SOPH
More Info
ContractCreator
Multichain Info
N/A
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
76173 | 48 days ago | Contract Creation | 0 SOPH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xeC719f51...7936d90BF The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
SignatureChecker
Compiler Version
v0.6.12+commit.27d51765
ZkSolc Version
v1.5.4
Optimization Enabled:
Yes with 200 runs
Other Settings:
istanbul EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
/** * Copyright 2023 Circle Internet Financial, LTD. 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; } }
/** * Copyright 2023 Circle Internet Financial, LTD. 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); } }
/** * Copyright 2023 Circle Internet Financial, LTD. 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); }
{ "viaIR": false, "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 }
[{"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"}]
Deployed Bytecode
0x00020000000000020002000000000002000000000301001900000060033002700000006e0430019700010000004103550000000100200190000000c00000c13d0000008002000039000000400020043f000000030040008c000000cf0000a13d000000000201043b000000640340008a000000830030009c000000cf0000213d0000007202200197000000730020009c000000cf0000c13d0000002402100370000000000702043b0000000402100370000000000302043b0000004402100370000000000202043b000000750020009c000000cf0000213d0000002406200039000000000046004b000000cf0000213d0000000405200039000000000251034f000000000202043b000000750020009c000000cf0000213d0000000006620019000000000046004b000000cf0000213d000200000007001d0000001f042000390000008404400197000000a004400039000000400040043f0000002004500039000000000441034f000000800020043f00000084052001980000001f0620018f000000a001500039000000380000613d000000a007000039000000000804034f000000008908043c0000000007970436000000000017004b000000340000c13d0000007407300197000000000006004b000000460000613d000000000354034f0000000304600210000000000501043300000000054501cf000000000545022f000000000303043b0000010004400089000000000343022f00000000034301cf000000000353019f0000000000310435000000a001200039000000000001043500000076010000410000000000100443000100000007001d000000040070044300000000010004140000006e0010009c0000006e01008041000000c00110021000000077011001c7000080020200003901b301ae0000040f0000000100200190000000d10000613d000000400200043d000000000101043b000000000001004b000000d20000c13d000000800100043d000000410010008c00000002070000290000011c0000c13d000000c00100043d0000007d0010009c000001760000813d000000e00300043d000000f8033002700000001b0430008a000000010040008c0000017c0000213d000000a00400043d0000000005020436000000400050043f0000008006200039000000000016043500000060012000390000000000410435000000400120003900000000003104350000000000750435000000400300043d000200000003001d0000000001320049000000a0011000390000006e0010009c0000006e0100804100000060011002100000006e0030009c0000006e0200004100000000020340190000004002200210000000000121019f00000000020004140000006e0020009c0000006e02008041000000c002200210000000000121019f000000010200003901b301ae0000040f000000000301001900000060033002700000006e03300197000000200030008c000000200400003900000000040340190000001f0540018f0000000206000029000000200760008a00000020064001900000000004670019000000930000613d000000000801034f000000008908043c0000000007970436000000000047004b0000008f0000c13d000000000005004b000000a00000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003001f00010000000103550000000100200190000001950000613d000000400100043d000000200210008a000000000202043300000074022001980000000103000029000001650000c13d00000044021000390000008203000041000000000032043500000024021000390000001c0300003900000000003204350000007c020000410000000000210435000000040210003900000020030000390000000000320435000000400200043d000000000121004900000064011000390000006e0010009c0000006e0100804100000060011002100000006e0020009c0000006e020080410000004002200210000000000121019f000001b5000104300000000b0100043d0000006f0110019700000070011001c70000000b0010043f0000000001000410000000000010043f0000000b0100043d0000006f0110019700000070011001c70000000b0010043f0000002001000039000001000010044300000120000004430000007101000041000001b40001042e0000000001000019000001b500010430000000000001042f0000004401200039000000400300003900000000003104350000002401200039000000020300002900000000003104350000006401200039000000800300043d00000000003104350000008401200039000000800600043d000000000006004b0000000102000029000000f20000613d00000000030000190000000004130019000000a005300039000000000505043300000000005404350000002003300039000000000063004b000000e10000413d00000000011600190000001f04600190000000f20000613d0000000003410049000000030140021000000100051000890000000014030434000000000454022f00000000045401cf0000000000430435000000400500043d0000000003510049000000200330008a0000000004350436000000400010043f0000000001040433000000780110019700000079061001c70000000000640435000000400100043d0000000007050433000000200070008c00000000050700190000000003010019000001090000413d0000000003010019000000000507001900000000460404340000000003630436000000200550008a000000200050008c000001030000813d000000000604043300000003045002100000010004400089000000010440020f000000000005004b00000000040060190000000005400089000000000556016f000000010440008a0000000006030433000000000464016f000000000454019f0000000000430435000000400400043d0000000003000414000000040020008c000001250000c13d00000001020000390000000003000031000001380000013d00000064012000390000007a03000041000000000031043500000044012000390000007b03000041000000000031043500000024012000390000002303000039000001840000013d000000000117001900000000014100490000006e0010009c0000006e0100804100000060011002100000006e0040009c0000006e040080410000004004400210000000000141019f0000006e0030009c0000006e03008041000000c003300210000000000131019f01b301ae0000040f000000010220018f000100000001035500000060011002700000006e0010019d0000006e03100197000000800a000039000000000003004b0000013d0000c13d00000060010000390000015c0000013d0000003f013000390000008405000041000000000451016f000000400100043d0000000004410019000000400040043f000000000a31043600000000045301700000001f0530018f00000000034a001900000001060003670000014f0000613d000000000706034f00000000080a0019000000007907043c0000000008980436000000000038004b0000014b0000c13d000000000005004b0000015c0000613d000000000446034f0000000305500210000000000603043300000000065601cf000000000656022f000000000404043b0000010005500089000000000454022f00000000045401cf000000000464019f0000000000430435000000000002004b0000000002000019000001680000613d0000000001010433000000200010008c0000000002000019000001680000413d000000790300004100000000020a0433000000000032004b00000000020000390000000102006039000000010120018f000000400200043d0000000000120435000000400100043d000000000212004900000020022000390000006e0020009c0000006e0200804100000060022002100000006e0010009c0000006e010080410000004001100210000000000112019f000001b40001042e00000064012000390000007e03000041000000000031043500000044012000390000007f03000041000001810000013d00000064012000390000007e0300004100000000003104350000004401200039000000800300004100000000003104350000002401200039000000260300003900000000003104350000007c010000410000000000120435000000040120003900000020030000390000000000310435000000400100043d000000000212004900000084022000390000006e0020009c0000006e0200804100000060022002100000006e0010009c0000006e010080410000004001100210000000000112019f000001b5000104300000001f0430018f00000081023001980000019e0000613d000000000501034f0000000006000019000000005705043c0000000006760436000000000026004b0000019a0000c13d000000000004004b000001ab0000613d000000000121034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001204350000006001300210000001b500010430000000000001042f000001b1002104230000000102000039000000000001042d0000000002000019000000000001042d000001b300000432000001b40001042e000001b5000104300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff73000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000040000001000000000000000000ffffffff000000000000000000000000000000000000000000000000000000006ccea65200000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000001000000001806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b83020000020000000000000000000000000000002400000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff1626ba7e00000000000000000000000000000000000000000000000000000000677468000000000000000000000000000000000000000000000000000000000045435265636f7665723a20696e76616c6964207369676e6174757265206c656e08c379a0000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a12076616c7565000000000000000000000000000000000000000000000000000045435265636f7665723a20696e76616c6964207369676e61747572652027732745435265636f7665723a20696e76616c6964207369676e61747572652027762700000000000000000000000000000000000000000000000000000000ffffffe045435265636f7665723a20696e76616c6964207369676e617475726500000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0000000000000000000000000000000000000000000000000000000000000000071280fefcd94fd7b102d5febdbdc74e26a45e107f2824ada402c5a5d21f1c1e8
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.