@openzeppelin/upgrades
Version:
JavaScript library for the OpenZeppelin smart contract platform
1,110 lines • 52.6 kB
JSON
{
"fileName": "ECDSA.sol",
"contractName": "OpenZeppelinUpgradesECDSA",
"source": "pragma solidity ^0.5.2;\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": "771:2638:5:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24",
"deployedSourceMap": "771:2638:5:-;;;;;;;;",
"abi": [],
"ast": {
"absolutePath": "contracts/cryptography/ECDSA.sol",
"exportedSymbols": {
"OpenZeppelinUpgradesECDSA": [
874
]
},
"id": 875,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 795,
"literals": [
"solidity",
"^",
"0.5",
".2"
],
"nodeType": "PragmaDirective",
"src": "0:23:5"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title Elliptic curve signature operations\n@dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d\nTODO Remove this library once solidity supports passing a signature to ecrecover.\nSee https://github.com/ethereum/solidity/issues/864\n * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/79dd498b16b957399f84b9aa7e720f98f9eb83e3/contracts/cryptography/ECDSA.sol\nThis contract is copied here and renamed from the original to avoid clashes in the compiled artifacts\nwhen the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the\nbuild/artifacts folder) as well as the vanilla implementation from an openzeppelin version.",
"fullyImplemented": true,
"id": 874,
"linearizedBaseContracts": [
874
],
"name": "OpenZeppelinUpgradesECDSA",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 856,
"nodeType": "Block",
"src": "1188:1804:5",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 807,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 804,
"name": "signature",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 799,
"src": "1240:9:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"id": 805,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1240:16:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "3635",
"id": 806,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1260:2:5",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_65_by_1",
"typeString": "int_const 65"
},
"value": "65"
},
"src": "1240:22:5",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 814,
"nodeType": "IfStatement",
"src": "1236:72:5",
"trueBody": {
"id": 813,
"nodeType": "Block",
"src": "1264:44:5",
"statements": [
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 809,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1294: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": 808,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1286:7:5",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 810,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1286:10:5",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"id": 811,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "1285:12:5",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"functionReturnParameters": 803,
"id": 812,
"nodeType": "Return",
"src": "1278:19:5"
}
]
}
},
{
"assignments": [
816
],
"declarations": [
{
"constant": false,
"id": 816,
"name": "r",
"nodeType": "VariableDeclaration",
"scope": 856,
"src": "1374:9:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 815,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1374:7:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 817,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "1374:9:5"
},
{
"assignments": [
819
],
"declarations": [
{
"constant": false,
"id": 819,
"name": "s",
"nodeType": "VariableDeclaration",
"scope": 856,
"src": "1393:9:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 818,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1393:7:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 820,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "1393:9:5"
},
{
"assignments": [
822
],
"declarations": [
{
"constant": false,
"id": 822,
"name": "v",
"nodeType": "VariableDeclaration",
"scope": 856,
"src": "1412:7:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 821,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "1412:5:5",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 823,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "1412:7:5"
},
{
"externalReferences": [
{
"r": {
"declaration": 816,
"isOffset": false,
"isSlot": false,
"src": "1632:1:5",
"valueSize": 1
}
},
{
"v": {
"declaration": 822,
"isOffset": false,
"isSlot": false,
"src": "1722:1:5",
"valueSize": 1
}
},
{
"signature": {
"declaration": 799,
"isOffset": false,
"isSlot": false,
"src": "1647:9:5",
"valueSize": 1
}
},
{
"s": {
"declaration": 819,
"isOffset": false,
"isSlot": false,
"src": "1677:1:5",
"valueSize": 1
}
},
{
"signature": {
"declaration": 799,
"isOffset": false,
"isSlot": false,
"src": "1692:9:5",
"valueSize": 1
}
},
{
"signature": {
"declaration": 799,
"isOffset": false,
"isSlot": false,
"src": "1745:9:5",
"valueSize": 1
}
}
],
"id": 824,
"nodeType": "InlineAssembly",
"operations": "{\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n}",
"src": "1609:1050:5"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 829,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 826,
"name": "s",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 819,
"src": "2669:1:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 825,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2661:7:5",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": "uint256"
},
"id": 827,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2661:10:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"argumentTypes": null,
"hexValue": "307837464646464646464646464646464646464646464646464646464646464646463544353736453733353741343530314444464539324634363638314232304130",
"id": 828,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2674:66:5",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_57896044618658097711785492504343953926418782139537452191302581570759080747168_by_1",
"typeString": "int_const 5789...(69 digits omitted)...7168"
},
"value": "0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0"
},
"src": "2661:79:5",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 835,
"nodeType": "IfStatement",
"src": "2657:127:5",
"trueBody": {
"id": 834,
"nodeType": "Block",
"src": "2742:42:5",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 831,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2771: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": 830,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2763:7:5",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 832,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2763:10:5",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"functionReturnParameters": 803,
"id": 833,
"nodeType": "Return",
"src": "2756:17:5"
}
]
}
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 842,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"id": 838,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 836,
"name": "v",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 822,
"src": "2798:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "3237",
"id": 837,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2803:2:5",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_27_by_1",
"typeString": "int_const 27"
},
"value": "27"
},
"src": "2798:7:5",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"id": 841,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 839,
"name": "v",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 822,
"src": "2809:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "3238",
"id": 840,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2814:2:5",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_28_by_1",
"typeString": "int_const 28"
},
"value": "28"
},
"src": "2809:7:5",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "2798:18:5",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 848,
"nodeType": "IfStatement",
"src": "2794:66:5",
"trueBody": {
"id": 847,
"nodeType": "Block",
"src": "2818:42:5",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 844,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2847: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": 843,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "2839:7:5",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 845,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2839:10:5",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"functionReturnParameters": 803,
"id": 846,
"nodeType": "Return",
"src": "2832:17:5"
}
]
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 850,
"name": "hash",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 797,
"src": "2971:4:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"id": 851,
"name": "v",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 822,
"src": "2977:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
{
"argumentTypes": null,
"id": 852,
"name": "r",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 816,
"src": "2980:1:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"id": 853,
"name": "s",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 819,
"src": "2983: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": 849,
"name": "ecrecover",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6455,
"src": "2961: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": 854,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2961:24:5",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"functionReturnParameters": 803,
"id": 855,
"nodeType": "Return",
"src": "2954:31:5"
}
]
},
"documentation": "@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": 857,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "recover",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 800,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 797,
"name": "hash",
"nodeType": "VariableDeclaration",
"scope": 857,
"src": "1118:12:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 796,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1118:7:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 799,
"name": "signature",
"nodeType": "VariableDeclaration",
"scope": 857,
"src": "1132:22:5",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 798,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1132:5:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1117:38:5"
},
"returnParameters": {
"id": 803,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 802,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 857,
"src": "1179:7:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 801,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1179:7:5",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1178:9:5"
},
"scope": 874,
"src": "1101:1891:5",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 872,
"nodeType": "Block",
"src": "3220:187:5",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "19457468657265756d205369676e6564204d6573736167653a0a3332",
"id": 867,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "3358:34:5",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_178a2411ab6fbc1ba11064408972259c558d0e82fd48b0aba3ad81d14f065e73",
"typeString": "literal_string \"\u0019Ethereum Signed Message:\n32\""
},
"value": "\u0019Ethereum Signed Message:\n32"
},
{
"argumentTypes": null,
"id": 868,
"name": "hash",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 859,
"src": "3394:4:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_178a2411ab6fbc1ba11064408972259c558d0e82fd48b0aba3ad81d14f065e73",
"typeString": "literal_string \"\u0019Ethereum Signed Message:\n32\""
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"expression": {
"argumentTypes": null,
"id": 865,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6450,
"src": "3341:3:5",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 866,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodePacked",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3341:16:5",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$",
"typeString": "function () pure returns (bytes memory)"
}
},
"id": 869,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3341:58:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 864,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6457,
"src": "3331:9:5",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 870,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3331:69:5",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"functionReturnParameters": 863,
"id": 871,
"nodeType": "Return",
"src": "3324:76:5"
}
]
},
"documentation": "toEthSignedMessageHash\n@dev prefix a bytes32 value with \"\\x19Ethereum Signed Message:\"\nand hash the result",
"id": 873,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "toEthSignedMessageHash",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 860,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 859,
"name": "hash",
"nodeType": "VariableDeclaration",
"scope": 873,
"src": "3174:12:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32