UNPKG

@aragon/apps-payroll

Version:

_**Code in Github:**_ [aragon-apps/apps/payroll](https://github.com/aragon/aragon-apps/tree/master/future-apps/payroll)

888 lines 32.4 kB
{ "contractName": "DelegateProxy", "abi": [ { "constant": true, "inputs": [], "name": "proxyType", "outputs": [ { "name": "proxyTypeId", "type": "uint256" } ], "payable": false, "stateMutability": "pure", "type": "function" }, { "constant": true, "inputs": [], "name": "implementation", "outputs": [ { "name": "codeAddr", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "bytecode": "0x", "deployedBytecode": "0x", "sourceMap": "", "deployedSourceMap": "", "source": "pragma solidity 0.4.24;\n\nimport \"../common/IsContract.sol\";\nimport \"../lib/misc/ERCProxy.sol\";\n\n\ncontract DelegateProxy is ERCProxy, IsContract {\n uint256 internal constant FWD_GAS_LIMIT = 10000;\n\n /**\n * @dev Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!)\n * @param _dst Destination address to perform the delegatecall\n * @param _calldata Calldata for the delegatecall\n */\n function delegatedFwd(address _dst, bytes _calldata) internal {\n require(isContract(_dst));\n uint256 fwdGasLimit = FWD_GAS_LIMIT;\n\n assembly {\n let result := delegatecall(sub(gas, fwdGasLimit), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)\n let size := returndatasize\n let ptr := mload(0x40)\n returndatacopy(ptr, 0, size)\n\n // revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.\n // if the call returned error data, forward it\n switch result case 0 { revert(ptr, size) }\n default { return(ptr, size) }\n }\n }\n}\n", "sourcePath": "@aragon/os/contracts/common/DelegateProxy.sol", "ast": { "absolutePath": "@aragon/os/contracts/common/DelegateProxy.sol", "exportedSymbols": { "DelegateProxy": [ 10583 ] }, "id": 10584, "nodeType": "SourceUnit", "nodes": [ { "id": 10554, "literals": [ "solidity", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:23:26" }, { "absolutePath": "@aragon/os/contracts/common/IsContract.sol", "file": "../common/IsContract.sol", "id": 10555, "nodeType": "ImportDirective", "scope": 10584, "sourceUnit": 10839, "src": "25:34:26", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/lib/misc/ERCProxy.sol", "file": "../lib/misc/ERCProxy.sol", "id": 10556, "nodeType": "ImportDirective", "scope": 10584, "sourceUnit": 14226, "src": "60:34:26", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 10557, "name": "ERCProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 14225, "src": "123:8:26", "typeDescriptions": { "typeIdentifier": "t_contract$_ERCProxy_$14225", "typeString": "contract ERCProxy" } }, "id": 10558, "nodeType": "InheritanceSpecifier", "src": "123:8:26" }, { "arguments": null, "baseName": { "contractScope": null, "id": 10559, "name": "IsContract", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 10838, "src": "133:10:26", "typeDescriptions": { "typeIdentifier": "t_contract$_IsContract_$10838", "typeString": "contract IsContract" } }, "id": 10560, "nodeType": "InheritanceSpecifier", "src": "133:10:26" } ], "contractDependencies": [ 10838, 14225 ], "contractKind": "contract", "documentation": null, "fullyImplemented": false, "id": 10583, "linearizedBaseContracts": [ 10583, 10838, 14225 ], "name": "DelegateProxy", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 10563, "name": "FWD_GAS_LIMIT", "nodeType": "VariableDeclaration", "scope": 10583, "src": "150:47:26", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 10561, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "150:7:26", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "3130303030", "id": 10562, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "192:5:26", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_10000_by_1", "typeString": "int_const 10000" }, "value": "10000" }, "visibility": "internal" }, { "body": { "id": 10581, "nodeType": "Block", "src": "522:617:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 10572, "name": "_dst", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10565, "src": "551:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 10571, "name": "isContract", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10837, "src": "540:10:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_bool_$", "typeString": "function (address) view returns (bool)" } }, "id": 10573, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "540:16:26", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 10570, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 15156, 15157 ], "referencedDeclaration": 15156, "src": "532:7:26", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 10574, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "532:25:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 10575, "nodeType": "ExpressionStatement", "src": "532:25:26" }, { "assignments": [ 10577 ], "declarations": [ { "constant": false, "id": 10577, "name": "fwdGasLimit", "nodeType": "VariableDeclaration", "scope": 10582, "src": "567:19:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 10576, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "567:7:26", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 10579, "initialValue": { "argumentTypes": null, "id": 10578, "name": "FWD_GAS_LIMIT", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10563, "src": "589:13:26", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "567:35:26" }, { "externalReferences": [ { "fwdGasLimit": { "declaration": 10577, "isOffset": false, "isSlot": false, "src": "672:11:26", "valueSize": 1 } }, { "_calldata": { "declaration": 10567, "isOffset": false, "isSlot": false, "src": "720:9:26", "valueSize": 1 } }, { "_calldata": { "declaration": 10567, "isOffset": false, "isSlot": false, "src": "696:9:26", "valueSize": 1 } }, { "_dst": { "declaration": 10565, "isOffset": false, "isSlot": false, "src": "686:4:26", "valueSize": 1 } } ], "id": 10580, "nodeType": "InlineAssembly", "operations": "{\n let result := delegatecall(sub(gas(), fwdGasLimit), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)\n let size := returndatasize()\n let ptr := mload(0x40)\n returndatacopy(ptr, 0, size)\n switch result\n case 0 {\n revert(ptr, size)\n }\n default {\n return(ptr, size)\n }\n}", "src": "613:526:26" } ] }, "documentation": "@dev Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!)\n@param _dst Destination address to perform the delegatecall\n@param _calldata Calldata for the delegatecall", "id": 10582, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "delegatedFwd", "nodeType": "FunctionDefinition", "parameters": { "id": 10568, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 10565, "name": "_dst", "nodeType": "VariableDeclaration", "scope": 10582, "src": "482:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 10564, "name": "address", "nodeType": "ElementaryTypeName", "src": "482:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 10567, "name": "_calldata", "nodeType": "VariableDeclaration", "scope": 10582, "src": "496:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 10566, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "496:5:26", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "src": "481:31:26" }, "payable": false, "returnParameters": { "id": 10569, "nodeType": "ParameterList", "parameters": [], "src": "522:0:26" }, "scope": 10583, "src": "460:679:26", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 10584, "src": "97:1044:26" } ], "src": "0:1142:26" }, "legacyAST": { "absolutePath": "@aragon/os/contracts/common/DelegateProxy.sol", "exportedSymbols": { "DelegateProxy": [ 10583 ] }, "id": 10584, "nodeType": "SourceUnit", "nodes": [ { "id": 10554, "literals": [ "solidity", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:23:26" }, { "absolutePath": "@aragon/os/contracts/common/IsContract.sol", "file": "../common/IsContract.sol", "id": 10555, "nodeType": "ImportDirective", "scope": 10584, "sourceUnit": 10839, "src": "25:34:26", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/lib/misc/ERCProxy.sol", "file": "../lib/misc/ERCProxy.sol", "id": 10556, "nodeType": "ImportDirective", "scope": 10584, "sourceUnit": 14226, "src": "60:34:26", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 10557, "name": "ERCProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 14225, "src": "123:8:26", "typeDescriptions": { "typeIdentifier": "t_contract$_ERCProxy_$14225", "typeString": "contract ERCProxy" } }, "id": 10558, "nodeType": "InheritanceSpecifier", "src": "123:8:26" }, { "arguments": null, "baseName": { "contractScope": null, "id": 10559, "name": "IsContract", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 10838, "src": "133:10:26", "typeDescriptions": { "typeIdentifier": "t_contract$_IsContract_$10838", "typeString": "contract IsContract" } }, "id": 10560, "nodeType": "InheritanceSpecifier", "src": "133:10:26" } ], "contractDependencies": [ 10838, 14225 ], "contractKind": "contract", "documentation": null, "fullyImplemented": false, "id": 10583, "linearizedBaseContracts": [ 10583, 10838, 14225 ], "name": "DelegateProxy", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 10563, "name": "FWD_GAS_LIMIT", "nodeType": "VariableDeclaration", "scope": 10583, "src": "150:47:26", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 10561, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "150:7:26", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "3130303030", "id": 10562, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "192:5:26", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_10000_by_1", "typeString": "int_const 10000" }, "value": "10000" }, "visibility": "internal" }, { "body": { "id": 10581, "nodeType": "Block", "src": "522:617:26", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 10572, "name": "_dst", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10565, "src": "551:4:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 10571, "name": "isContract", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10837, "src": "540:10:26", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_bool_$", "typeString": "function (address) view returns (bool)" } }, "id": 10573, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "540:16:26", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 10570, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 15156, 15157 ], "referencedDeclaration": 15156, "src": "532:7:26", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 10574, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "532:25:26", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 10575, "nodeType": "ExpressionStatement", "src": "532:25:26" }, { "assignments": [ 10577 ], "declarations": [ { "constant": false, "id": 10577, "name": "fwdGasLimit", "nodeType": "VariableDeclaration", "scope": 10582, "src": "567:19:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 10576, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "567:7:26", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 10579, "initialValue": { "argumentTypes": null, "id": 10578, "name": "FWD_GAS_LIMIT", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10563, "src": "589:13:26", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "567:35:26" }, { "externalReferences": [ { "fwdGasLimit": { "declaration": 10577, "isOffset": false, "isSlot": false, "src": "672:11:26", "valueSize": 1 } }, { "_calldata": { "declaration": 10567, "isOffset": false, "isSlot": false, "src": "720:9:26", "valueSize": 1 } }, { "_calldata": { "declaration": 10567, "isOffset": false, "isSlot": false, "src": "696:9:26", "valueSize": 1 } }, { "_dst": { "declaration": 10565, "isOffset": false, "isSlot": false, "src": "686:4:26", "valueSize": 1 } } ], "id": 10580, "nodeType": "InlineAssembly", "operations": "{\n let result := delegatecall(sub(gas(), fwdGasLimit), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)\n let size := returndatasize()\n let ptr := mload(0x40)\n returndatacopy(ptr, 0, size)\n switch result\n case 0 {\n revert(ptr, size)\n }\n default {\n return(ptr, size)\n }\n}", "src": "613:526:26" } ] }, "documentation": "@dev Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!)\n@param _dst Destination address to perform the delegatecall\n@param _calldata Calldata for the delegatecall", "id": 10582, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "delegatedFwd", "nodeType": "FunctionDefinition", "parameters": { "id": 10568, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 10565, "name": "_dst", "nodeType": "VariableDeclaration", "scope": 10582, "src": "482:12:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 10564, "name": "address", "nodeType": "ElementaryTypeName", "src": "482:7:26", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 10567, "name": "_calldata", "nodeType": "VariableDeclaration", "scope": 10582, "src": "496:15:26", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 10566, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "496:5:26", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "src": "481:31:26" }, "payable": false, "returnParameters": { "id": 10569, "nodeType": "ParameterList", "parameters": [], "src": "522:0:26" }, "scope": 10583, "src": "460:679:26", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 10584, "src": "97:1044:26" } ], "src": "0:1142:26" }, "compiler": { "name": "solc", "version": "0.4.24+commit.e67f0147.Emscripten.clang" }, "networks": {}, "schemaVersion": "2.0.1", "updatedAt": "2019-09-04T11:02:55.760Z" }