UNPKG

@daostack/upgrades

Version:
1,110 lines 62 kB
{ "fileName": "ECDSA.sol", "contractName": "OpenZeppelinUpgradesECDSA", "source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n\n/**\n * @title Elliptic curve signature operations\n * @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d\n * TODO Remove this library once solidity supports passing a signature to ecrecover.\n * See https://github.com/ethereum/solidity/issues/864\n *\n * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/79dd498b16b957399f84b9aa7e720f98f9eb83e3/contracts/cryptography/ECDSA.sol\n * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts\n * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the\n * build/artifacts folder) as well as the vanilla implementation from an openzeppelin version.\n */\n\nlibrary OpenZeppelinUpgradesECDSA {\n /**\n * @dev Recover signer address from a message by using their signature\n * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.\n * @param signature bytes signature, the signature is generated using web3.eth.sign()\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n // Check the signature length\n if (signature.length != 65) {\n return (address(0));\n }\n\n // Divide the signature in r, s and v variables\n bytes32 r;\n bytes32 s;\n uint8 v;\n\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return address(0);\n }\n\n if (v != 27 && v != 28) {\n return address(0);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n return ecrecover(hash, v, r, s);\n }\n\n /**\n * toEthSignedMessageHash\n * @dev prefix a bytes32 value with \"\\x19Ethereum Signed Message:\"\n * and hash the result\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n}\n", "sourcePath": "contracts/cryptography/ECDSA.sol", "sourceMap": "803:2638:5:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "803:2638:5:-:0;;;;;;;;;;;;;;", "abi": [], "ast": { "absolutePath": "contracts/cryptography/ECDSA.sol", "exportedSymbols": { "OpenZeppelinUpgradesECDSA": [ 937 ] }, "id": 938, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 851, "literals": [ "solidity", "^", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:5" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": { "id": 852, "nodeType": "StructuredDocumentation", "src": "57:744:5", "text": " @title Elliptic curve signature operations\n @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d\n TODO Remove this library once solidity supports passing a signature to ecrecover.\n See https://github.com/ethereum/solidity/issues/864\n Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/79dd498b16b957399f84b9aa7e720f98f9eb83e3/contracts/cryptography/ECDSA.sol\n This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts\n when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the\n build/artifacts folder) as well as the vanilla implementation from an openzeppelin version." }, "fullyImplemented": true, "id": 937, "linearizedBaseContracts": [ 937 ], "name": "OpenZeppelinUpgradesECDSA", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 918, "nodeType": "Block", "src": "1220:1804:5", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 865, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 862, "name": "signature", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 857, "src": "1272:9:5", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, "id": 863, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1272:16:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "3635", "id": 864, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1292:2:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_65_by_1", "typeString": "int_const 65" }, "value": "65" }, "src": "1272:22:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 873, "nodeType": "IfStatement", "src": "1268:72:5", "trueBody": { "id": 872, "nodeType": "Block", "src": "1296:44:5", "statements": [ { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 868, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1326:1:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 867, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1318:7:5", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 866, "name": "address", "nodeType": "ElementaryTypeName", "src": "1318:7:5", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 869, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1318:10:5", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "id": 870, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1317:12:5", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 861, "id": 871, "nodeType": "Return", "src": "1310:19:5" } ] } }, { "assignments": [ 875 ], "declarations": [ { "constant": false, "id": 875, "mutability": "mutable", "name": "r", "nodeType": "VariableDeclaration", "overrides": null, "scope": 918, "src": "1406:9:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 874, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1406:7:5", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "id": 876, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "1406:9:5" }, { "assignments": [ 878 ], "declarations": [ { "constant": false, "id": 878, "mutability": "mutable", "name": "s", "nodeType": "VariableDeclaration", "overrides": null, "scope": 918, "src": "1425:9:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 877, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1425:7:5", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "id": 879, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "1425:9:5" }, { "assignments": [ 881 ], "declarations": [ { "constant": false, "id": 881, "mutability": "mutable", "name": "v", "nodeType": "VariableDeclaration", "overrides": null, "scope": 918, "src": "1444:7:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 880, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "1444:5:5", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "id": 882, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "1444:7:5" }, { "AST": { "nodeType": "YulBlock", "src": "1650:155:5", "statements": [ { "nodeType": "YulAssignment", "src": "1664:32:5", "value": { "arguments": [ { "arguments": [ { "name": "signature", "nodeType": "YulIdentifier", "src": "1679:9:5" }, { "kind": "number", "nodeType": "YulLiteral", "src": "1690:4:5", "type": "", "value": "0x20" } ], "functionName": { "name": "add", "nodeType": "YulIdentifier", "src": "1675:3:5" }, "nodeType": "YulFunctionCall", "src": "1675:20:5" } ], "functionName": { "name": "mload", "nodeType": "YulIdentifier", "src": "1669:5:5" }, "nodeType": "YulFunctionCall", "src": "1669:27:5" }, "variableNames": [ { "name": "r", "nodeType": "YulIdentifier", "src": "1664:1:5" } ] }, { "nodeType": "YulAssignment", "src": "1709:32:5", "value": { "arguments": [ { "arguments": [ { "name": "signature", "nodeType": "YulIdentifier", "src": "1724:9:5" }, { "kind": "number", "nodeType": "YulLiteral", "src": "1735:4:5", "type": "", "value": "0x40" } ], "functionName": { "name": "add", "nodeType": "YulIdentifier", "src": "1720:3:5" }, "nodeType": "YulFunctionCall", "src": "1720:20:5" } ], "functionName": { "name": "mload", "nodeType": "YulIdentifier", "src": "1714:5:5" }, "nodeType": "YulFunctionCall", "src": "1714:27:5" }, "variableNames": [ { "name": "s", "nodeType": "YulIdentifier", "src": "1709:1:5" } ] }, { "nodeType": "YulAssignment", "src": "1754:41:5", "value": { "arguments": [ { "kind": "number", "nodeType": "YulLiteral", "src": "1764:1:5", "type": "", "value": "0" }, { "arguments": [ { "arguments": [ { "name": "signature", "nodeType": "YulIdentifier", "src": "1777:9:5" }, { "kind": "number", "nodeType": "YulLiteral", "src": "1788:4:5", "type": "", "value": "0x60" } ], "functionName": { "name": "add", "nodeType": "YulIdentifier", "src": "1773:3:5" }, "nodeType": "YulFunctionCall", "src": "1773:20:5" } ], "functionName": { "name": "mload", "nodeType": "YulIdentifier", "src": "1767:5:5" }, "nodeType": "YulFunctionCall", "src": "1767:27:5" } ], "functionName": { "name": "byte", "nodeType": "YulIdentifier", "src": "1759:4:5" }, "nodeType": "YulFunctionCall", "src": "1759:36:5" }, "variableNames": [ { "name": "v", "nodeType": "YulIdentifier", "src": "1754:1:5" } ] } ] }, "evmVersion": "constantinople", "externalReferences": [ { "declaration": 875, "isOffset": false, "isSlot": false, "src": "1664:1:5", "valueSize": 1 }, { "declaration": 878, "isOffset": false, "isSlot": false, "src": "1709:1:5", "valueSize": 1 }, { "declaration": 857, "isOffset": false, "isSlot": false, "src": "1679:9:5", "valueSize": 1 }, { "declaration": 857, "isOffset": false, "isSlot": false, "src": "1724:9:5", "valueSize": 1 }, { "declaration": 857, "isOffset": false, "isSlot": false, "src": "1777:9:5", "valueSize": 1 }, { "declaration": 881, "isOffset": false, "isSlot": false, "src": "1754:1:5", "valueSize": 1 } ], "id": 883, "nodeType": "InlineAssembly", "src": "1641:164:5" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 889, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 886, "name": "s", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 878, "src": "2701:1:5", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } ], "id": 885, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2693:7:5", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 884, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2693:7:5", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 887, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2693:10:5", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "307837464646464646464646464646464646464646464646464646464646464646463544353736453733353741343530314444464539324634363638314232304130", "id": 888, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2706:66:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_57896044618658097711785492504343953926418782139537452191302581570759080747168_by_1", "typeString": "int_const 5789...(69 digits omitted)...7168" }, "value": "0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0" }, "src": "2693:79:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 896, "nodeType": "IfStatement", "src": "2689:127:5", "trueBody": { "id": 895, "nodeType": "Block", "src": "2774:42:5", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 892, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2803:1:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 891, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2795:7:5", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 890, "name": "address", "nodeType": "ElementaryTypeName", "src": "2795:7:5", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 893, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2795:10:5", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 861, "id": 894, "nodeType": "Return", "src": "2788:17:5" } ] } }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 903, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 899, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 897, "name": "v", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 881, "src": "2830:1:5", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "3237", "id": 898, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2835:2:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_27_by_1", "typeString": "int_const 27" }, "value": "27" }, "src": "2830:7:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 902, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 900, "name": "v", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 881, "src": "2841:1:5", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "3238", "id": 901, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2846:2:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_28_by_1", "typeString": "int_const 28" }, "value": "28" }, "src": "2841:7:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "2830:18:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 910, "nodeType": "IfStatement", "src": "2826:66:5", "trueBody": { "id": 909, "nodeType": "Block", "src": "2850:42:5", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 906, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2879:1:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 905, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2871:7:5", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 904, "name": "address", "nodeType": "ElementaryTypeName", "src": "2871:7:5", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 907, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2871:10:5", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 861, "id": 908, "nodeType": "Return", "src": "2864:17:5" } ] } }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 912, "name": "hash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 855, "src": "3003:4:5", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, { "argumentTypes": null, "id": 913, "name": "v", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 881, "src": "3009:1:5", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, { "argumentTypes": null, "id": 914, "name": "r", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 875, "src": "3012:1:5", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, { "argumentTypes": null, "id": 915, "name": "s", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 878, "src": "3015:1:5", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, { "typeIdentifier": "t_uint8", "typeString": "uint8" }, { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } ], "id": 911, "name": "ecrecover", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -6, "src": "2993:9:5", "typeDescriptions": { "typeIdentifier": "t_function_ecrecover_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address)" } }, "id": 916, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2993:24:5", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 861, "id": 917, "nodeType": "Return", "src": "2986:31:5" } ] }, "documentation": { "id": 853, "nodeType": "StructuredDocumentation", "src": "843:285:5", "text": " @dev Recover signer address from a message by using their signature\n @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.\n @param signature bytes signature, the signature is generated using web3.eth.sign()" }, "id": 919, "implemented": true, "kind": "function", "modifiers": [], "name": "recover", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 858, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 855, "mutability": "mutable", "name": "hash", "nodeType": "VariableDeclaration", "overrides": null, "scope": 919, "src": "1150:12:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 854, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1150:7:5", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 857, "mutability": "mutable", "name": "signature", "nodeType": "VariableDeclaration", "overrides": null, "scope": 919, "src": "1164:22:5", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 856, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "1164:5:5"