UNPKG

@dolomite-exchange/dolomite-margin

Version:

Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol

1,089 lines (1,088 loc) 94.9 kB
{ "contractName": "Address", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Collection of functions related to the address type\",\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Address.sol\":\"Address\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x1a8e5072509c5ea7365eb1d48030b9be865140c8fb779968da0a459a0e174a11\",\"urls\":[\"bzz-raw://03335b7b07c7c8c8d613cfdd8ec39a0b5ec133ee510bf2fe6cc5a496767bef4b\",\"dweb:/ipfs/Qmebp4nzPja645c9yXSdJkGq96oU3am3LUnG2K3R7XxyKf\"]}},\"version\":1}", "bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820a30e00e840208a05252804dde7b29dbf4b62d98f0443025ead7b5527e09075cc64736f6c63430005100032", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820a30e00e840208a05252804dde7b29dbf4b62d98f0443025ead7b5527e09075cc64736f6c63430005100032", "sourceMap": "93:2861:154:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", "deployedSourceMap": "93:2861:154:-;;;;;;;;", "source": "pragma solidity ^0.5.5;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following \n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\n // for accounts without code, i.e. `keccak256('')`\n bytes32 codehash;\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n // solhint-disable-next-line no-inline-assembly\n assembly { codehash := extcodehash(account) }\n return (codehash != accountHash && codehash != 0x0);\n }\n\n /**\n * @dev Converts an `address` into `address payable`. Note that this is\n * simply a type cast: the actual underlying value is not changed.\n *\n * _Available since v2.4.0._\n */\n function toPayable(address account) internal pure returns (address payable) {\n return address(uint160(account));\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n *\n * _Available since v2.4.0._\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-call-value\n (bool success, ) = recipient.call.value(amount)(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n}\n", "sourcePath": "@openzeppelin/contracts/utils/Address.sol", "ast": { "absolutePath": "@openzeppelin/contracts/utils/Address.sol", "exportedSymbols": { "Address": [ 37847 ] }, "id": 37848, "nodeType": "SourceUnit", "nodes": [ { "id": 37774, "literals": [ "solidity", "^", "0.5", ".5" ], "nodeType": "PragmaDirective", "src": "0:23:154" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@dev Collection of functions related to the address type", "fullyImplemented": true, "id": 37847, "linearizedBaseContracts": [ 37847 ], "name": "Address", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 37798, "nodeType": "Block", "src": "752:544:154", "statements": [ { "assignments": [ 37782 ], "declarations": [ { "constant": false, "id": 37782, "name": "codehash", "nodeType": "VariableDeclaration", "scope": 37798, "src": "1004:16:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 37781, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1004:7:154", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "id": 37783, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "1004:16:154" }, { "assignments": [ 37785 ], "declarations": [ { "constant": false, "id": 37785, "name": "accountHash", "nodeType": "VariableDeclaration", "scope": 37798, "src": "1030:19:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 37784, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1030:7:154", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "id": 37787, "initialValue": { "argumentTypes": null, "hexValue": "307863356432343630313836663732333363393237653764623264636337303363306535303062363533636138323237336237626661643830343564383561343730", "id": 37786, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1052:66:154", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_89477152217924674838424037953991966239322087453347756267410168184682657981552_by_1", "typeString": "int_const 8947...(69 digits omitted)...1552" }, "value": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" }, "nodeType": "VariableDeclarationStatement", "src": "1030:88:154" }, { "externalReferences": [ { "codehash": { "declaration": 37782, "isOffset": false, "isSlot": false, "src": "1195:8:154", "valueSize": 1 } }, { "account": { "declaration": 37776, "isOffset": false, "isSlot": false, "src": "1219:7:154", "valueSize": 1 } } ], "id": 37788, "nodeType": "InlineAssembly", "operations": "{\n codehash := extcodehash(account)\n}", "src": "1184:45:154" }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 37795, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "id": 37791, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 37789, "name": "codehash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37782, "src": "1246:8:154", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "id": 37790, "name": "accountHash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37785, "src": "1258:11:154", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "src": "1246:23:154", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "id": 37794, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 37792, "name": "codehash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37782, "src": "1273:8:154", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "307830", "id": 37793, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1285:3:154", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0x0" }, "src": "1273:15:154", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "1246:42:154", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "id": 37796, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1245:44:154", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 37780, "id": 37797, "nodeType": "Return", "src": "1238:51:154" } ] }, "documentation": "@dev Returns true if `account` is a contract.\n * [IMPORTANT]\n====\nIt is unsafe to assume that an address for which this function returns\nfalse is an externally-owned account (EOA) and not a contract.\n * Among others, `isContract` will return false for the following \ntypes of addresses:\n * - an externally-owned account\n - a contract in construction\n - an address where a contract will be created\n - an address where a contract lived, but was destroyed\n====", "id": 37799, "implemented": true, "kind": "function", "modifiers": [], "name": "isContract", "nodeType": "FunctionDefinition", "parameters": { "id": 37777, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37776, "name": "account", "nodeType": "VariableDeclaration", "scope": 37799, "src": "706:15:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 37775, "name": "address", "nodeType": "ElementaryTypeName", "src": "706:7:154", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "705:17:154" }, "returnParameters": { "id": 37780, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37779, "name": "", "nodeType": "VariableDeclaration", "scope": 37799, "src": "746:4:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 37778, "name": "bool", "nodeType": "ElementaryTypeName", "src": "746:4:154", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "745:6:154" }, "scope": 37847, "src": "686:610:154", "stateMutability": "view", "superFunction": null, "visibility": "internal" }, { "body": { "id": 37812, "nodeType": "Block", "src": "1581:49:154", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 37808, "name": "account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37801, "src": "1614:7:154", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 37807, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1606:7:154", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint160_$", "typeString": "type(uint160)" }, "typeName": "uint160" }, "id": 37809, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1606:16:154", "typeDescriptions": { "typeIdentifier": "t_uint160", "typeString": "uint160" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint160", "typeString": "uint160" } ], "id": 37806, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1598:7:154", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 37810, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1598:25:154", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 37805, "id": 37811, "nodeType": "Return", "src": "1591:32:154" } ] }, "documentation": "@dev Converts an `address` into `address payable`. Note that this is\nsimply a type cast: the actual underlying value is not changed.\n * _Available since v2.4.0._", "id": 37813, "implemented": true, "kind": "function", "modifiers": [], "name": "toPayable", "nodeType": "FunctionDefinition", "parameters": { "id": 37802, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37801, "name": "account", "nodeType": "VariableDeclaration", "scope": 37813, "src": "1524:15:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 37800, "name": "address", "nodeType": "ElementaryTypeName", "src": "1524:7:154", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1523:17:154" }, "returnParameters": { "id": 37805, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37804, "name": "", "nodeType": "VariableDeclaration", "scope": 37813, "src": "1564:15:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 37803, "name": "address", "nodeType": "ElementaryTypeName", "src": "1564:15:154", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" } ], "src": "1563:17:154" }, "scope": 37847, "src": "1505:125:154", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 37845, "nodeType": "Block", "src": "2658:294:154", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 37826, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 37822, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38251, "src": "2684:4:154", "typeDescriptions": { "typeIdentifier": "t_contract$_Address_$37847", "typeString": "library Address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Address_$37847", "typeString": "library Address" } ], "id": 37821, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2676:7:154", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 37823, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2676:13:154", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 37824, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "balance", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2676:21:154", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 37825, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37817, "src": "2701:6:154", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2676:31:154", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "416464726573733a20696e73756666696369656e742062616c616e6365", "id": 37827, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2709:31:154", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_5597a22abd0ef5332f8053862eb236db7590f17e2b93a53f63a103becfb561f9", "typeString": "literal_string \"Address: insufficient balance\"" }, "value": "Address: insufficient balance" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_5597a22abd0ef5332f8053862eb236db7590f17e2b93a53f63a103becfb561f9", "typeString": "literal_string \"Address: insufficient balance\"" } ], "id": 37820, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 38110, 38111 ], "referencedDeclaration": 38111, "src": "2668:7:154", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 37828, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2668:73:154", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 37829, "nodeType": "ExpressionStatement", "src": "2668:73:154" }, { "assignments": [ 37831, null ], "declarations": [ { "constant": false, "id": 37831, "name": "success", "nodeType": "VariableDeclaration", "scope": 37845, "src": "2807:12:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 37830, "name": "bool", "nodeType": "ElementaryTypeName", "src": "2807:4:154", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" }, null ], "id": 37839, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "", "id": 37837, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2854:2:154", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", "typeString": "literal_string \"\"" }, "value": "" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", "typeString": "literal_string \"\"" } ], "arguments": [ { "argumentTypes": null, "id": 37835, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37817, "src": "2846:6:154", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 37832, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37815, "src": "2825:9:154", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 37833, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "call", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2825:14:154", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "function (bytes memory) payable returns (bool,bytes memory)" } }, "id": 37834, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2825:20:154", "typeDescriptions": { "typeIdentifier": "t_function_setvalue_pure$_t_uint256_$returns$_t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value_$", "typeString": "function (uint256) pure returns (function (bytes memory) payable returns (bool,bytes memory))" } }, "id": 37836, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2825:28:154", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", "typeString": "function (bytes memory) payable returns (bool,bytes memory)" } }, "id": 37838, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2825:32:154", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "tuple(bool,bytes memory)" } }, "nodeType": "VariableDeclarationStatement", "src": "2806:51:154" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 37841, "name": "success", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37831, "src": "2875:7:154", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564", "id": 37842, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2884:60:154", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_51ddaa38748c0a1144620fb5bfe8edab31ea437571ad591a7734bbfd0429aeae", "typeString": "literal_string \"Address: unable to send value, recipient may have reverted\"" }, "value": "Address: unable to send value, recipient may have reverted" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_51ddaa38748c0a1144620fb5bfe8edab31ea437571ad591a7734bbfd0429aeae", "typeString": "literal_string \"Address: unable to send value, recipient may have reverted\"" } ], "id": 37840, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 38110, 38111 ], "referencedDeclaration": 38111, "src": "2867:7:154", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 37843, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2867:78:154", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 37844, "nodeType": "ExpressionStatement", "src": "2867:78:154" } ] }, "documentation": "@dev Replacement for Solidity's `transfer`: sends `amount` wei to\n`recipient`, forwarding all available gas and reverting on errors.\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\nof certain opcodes, possibly making contracts go over the 2300 gas limit\nimposed by `transfer`, making them unable to receive funds via\n`transfer`. {sendValue} removes this limitation.\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n * IMPORTANT: because control is transferred to `recipient`, care must be\ntaken to not create reentrancy vulnerabilities. Consider using\n{ReentrancyGuard} or the\nhttps://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n * _Available since v2.4.0._", "id": 37846, "implemented": true, "kind": "function", "modifiers": [], "name": "sendValue", "nodeType": "FunctionDefinition", "parameters": { "id": 37818, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37815, "name": "recipient", "nodeType": "VariableDeclaration", "scope": 37846, "src": "2606:25:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 37814, "name": "address", "nodeType": "ElementaryTypeName", "src": "2606:15:154", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 37817, "name": "amount", "nodeType": "VariableDeclaration", "scope": 37846, "src": "2633:14:154", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 37816, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2633:7:154", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2605:43:154" }, "returnParameters": { "id": 37819, "nodeType": "ParameterList", "parameters": [], "src": "2658:0:154" }, "scope": 37847, "src": "2587:365:154", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 37848, "src": "93:2861:154" } ], "src": "0:2955:154" }, "legacyAST": { "absolutePath": "@openzeppelin/contracts/utils/Address.sol", "exportedSymbols": { "Address": [ 37847 ] }, "id": 37848, "nodeType": "SourceUnit", "nodes": [ { "id": 37774, "literals": [ "solidity", "^", "0.5", ".5" ], "nodeType": "PragmaDirective", "src": "0:23:154"