UNPKG

@aragon/apps-payroll

Version:

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

1,060 lines 39.9 kB
{ "contractName": "DepositableDelegateProxy", "abi": [ { "constant": true, "inputs": [], "name": "proxyType", "outputs": [ { "name": "proxyTypeId", "type": "uint256" } ], "payable": false, "stateMutability": "pure", "type": "function" }, { "constant": true, "inputs": [], "name": "isDepositable", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "implementation", "outputs": [ { "name": "codeAddr", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" } ], "name": "ProxyDeposit", "type": "event" } ], "bytecode": "0x", "deployedBytecode": "0x", "sourceMap": "", "deployedSourceMap": "", "source": "pragma solidity 0.4.24;\n\nimport \"./DelegateProxy.sol\";\nimport \"./DepositableStorage.sol\";\n\n\ncontract DepositableDelegateProxy is DepositableStorage, DelegateProxy {\n event ProxyDeposit(address sender, uint256 value);\n\n function () external payable {\n uint256 forwardGasThreshold = FWD_GAS_LIMIT;\n bytes32 isDepositablePosition = DEPOSITABLE_POSITION;\n\n // Optimized assembly implementation to prevent EIP-1884 from breaking deposits, reference code in Solidity:\n // https://github.com/aragon/aragonOS/blob/v4.2.1/contracts/common/DepositableDelegateProxy.sol#L10-L20\n assembly {\n // Continue only if the gas left is lower than the threshold for forwarding to the implementation code,\n // otherwise continue outside of the assembly block.\n if lt(gas, forwardGasThreshold) {\n // Only accept the deposit and emit an event if all of the following are true:\n // the proxy accepts deposits (isDepositable), msg.data.length == 0, and msg.value > 0\n if and(and(sload(isDepositablePosition), iszero(calldatasize)), gt(callvalue, 0)) {\n // Equivalent Solidity code for emitting the event:\n // emit ProxyDeposit(msg.sender, msg.value);\n\n let logData := mload(0x40) // free memory pointer\n mstore(logData, caller) // add 'msg.sender' to the log data (first event param)\n mstore(add(logData, 0x20), callvalue) // add 'msg.value' to the log data (second event param)\n\n // Emit an event with one topic to identify the event: keccak256('ProxyDeposit(address,uint256)') = 0x15ee...dee1\n log1(logData, 0x40, 0x15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1)\n\n stop() // Stop. Exits execution context\n }\n\n // If any of above checks failed, revert the execution (if ETH was sent, it is returned to the sender)\n revert(0, 0)\n }\n }\n\n address target = implementation();\n delegatedFwd(target, msg.data);\n }\n}\n", "sourcePath": "@aragon/os/contracts/common/DepositableDelegateProxy.sol", "ast": { "absolutePath": "@aragon/os/contracts/common/DepositableDelegateProxy.sol", "exportedSymbols": { "DepositableDelegateProxy": [ 10622 ] }, "id": 10623, "nodeType": "SourceUnit", "nodes": [ { "id": 10585, "literals": [ "solidity", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:23:27" }, { "absolutePath": "@aragon/os/contracts/common/DelegateProxy.sol", "file": "./DelegateProxy.sol", "id": 10586, "nodeType": "ImportDirective", "scope": 10623, "sourceUnit": 10584, "src": "25:29:27", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/common/DepositableStorage.sol", "file": "./DepositableStorage.sol", "id": 10587, "nodeType": "ImportDirective", "scope": 10623, "sourceUnit": 10655, "src": "55:34:27", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 10588, "name": "DepositableStorage", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 10654, "src": "129:18:27", "typeDescriptions": { "typeIdentifier": "t_contract$_DepositableStorage_$10654", "typeString": "contract DepositableStorage" } }, "id": 10589, "nodeType": "InheritanceSpecifier", "src": "129:18:27" }, { "arguments": null, "baseName": { "contractScope": null, "id": 10590, "name": "DelegateProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 10583, "src": "149:13:27", "typeDescriptions": { "typeIdentifier": "t_contract$_DelegateProxy_$10583", "typeString": "contract DelegateProxy" } }, "id": 10591, "nodeType": "InheritanceSpecifier", "src": "149:13:27" } ], "contractDependencies": [ 10583, 10654, 10838, 14225 ], "contractKind": "contract", "documentation": null, "fullyImplemented": false, "id": 10622, "linearizedBaseContracts": [ 10622, 10583, 10838, 14225, 10654 ], "name": "DepositableDelegateProxy", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 10597, "name": "ProxyDeposit", "nodeType": "EventDefinition", "parameters": { "id": 10596, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 10593, "indexed": false, "name": "sender", "nodeType": "VariableDeclaration", "scope": 10597, "src": "188:14:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 10592, "name": "address", "nodeType": "ElementaryTypeName", "src": "188:7:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 10595, "indexed": false, "name": "value", "nodeType": "VariableDeclaration", "scope": 10597, "src": "204:13:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 10594, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "204:7:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "187:31:27" }, "src": "169:50:27" }, { "body": { "id": 10620, "nodeType": "Block", "src": "254:1897:27", "statements": [ { "assignments": [ 10601 ], "declarations": [ { "constant": false, "id": 10601, "name": "forwardGasThreshold", "nodeType": "VariableDeclaration", "scope": 10621, "src": "264:27:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 10600, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "264:7:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 10603, "initialValue": { "argumentTypes": null, "id": 10602, "name": "FWD_GAS_LIMIT", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10563, "src": "294:13:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "264:43:27" }, { "assignments": [ 10605 ], "declarations": [ { "constant": false, "id": 10605, "name": "isDepositablePosition", "nodeType": "VariableDeclaration", "scope": 10621, "src": "317:29:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 10604, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "317:7:27", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "id": 10607, "initialValue": { "argumentTypes": null, "id": 10606, "name": "DEPOSITABLE_POSITION", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10631, "src": "349:20:27", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "VariableDeclarationStatement", "src": "317:52:27" }, { "externalReferences": [ { "forwardGasThreshold": { "declaration": 10601, "isOffset": false, "isSlot": false, "src": "824:19:27", "valueSize": 1 } }, { "isDepositablePosition": { "declaration": 10605, "isOffset": false, "isSlot": false, "src": "1078:21:27", "valueSize": 1 } } ], "id": 10608, "nodeType": "InlineAssembly", "operations": "{\n if lt(gas(), forwardGasThreshold)\n {\n if and(and(sload(isDepositablePosition), iszero(calldatasize())), gt(callvalue(), 0))\n {\n let logData := mload(0x40)\n mstore(logData, caller())\n mstore(add(logData, 0x20), callvalue())\n log1(logData, 0x40, 0x15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1)\n stop()\n }\n revert(0, 0)\n }\n}", "src": "609:1469:27" }, { "assignments": [ 10610 ], "declarations": [ { "constant": false, "id": 10610, "name": "target", "nodeType": "VariableDeclaration", "scope": 10621, "src": "2071:14:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 10609, "name": "address", "nodeType": "ElementaryTypeName", "src": "2071:7:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "id": 10613, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 10611, "name": "implementation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14224, "src": "2088:14:27", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 10612, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2088:16:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "VariableDeclarationStatement", "src": "2071:33:27" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 10615, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10610, "src": "2127:6:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 10616, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 15153, "src": "2135:3:27", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 10617, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "data", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2135:8:27", "typeDescriptions": { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } ], "id": 10614, "name": "delegatedFwd", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10582, "src": "2114:12:27", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$returns$__$", "typeString": "function (address,bytes memory)" } }, "id": 10618, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2114:30:27", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 10619, "nodeType": "ExpressionStatement", "src": "2114:30:27" } ] }, "documentation": null, "id": 10621, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 10598, "nodeType": "ParameterList", "parameters": [], "src": "234:2:27" }, "payable": true, "returnParameters": { "id": 10599, "nodeType": "ParameterList", "parameters": [], "src": "254:0:27" }, "scope": 10622, "src": "225:1926:27", "stateMutability": "payable", "superFunction": null, "visibility": "external" } ], "scope": 10623, "src": "92:2061:27" } ], "src": "0:2154:27" }, "legacyAST": { "absolutePath": "@aragon/os/contracts/common/DepositableDelegateProxy.sol", "exportedSymbols": { "DepositableDelegateProxy": [ 10622 ] }, "id": 10623, "nodeType": "SourceUnit", "nodes": [ { "id": 10585, "literals": [ "solidity", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:23:27" }, { "absolutePath": "@aragon/os/contracts/common/DelegateProxy.sol", "file": "./DelegateProxy.sol", "id": 10586, "nodeType": "ImportDirective", "scope": 10623, "sourceUnit": 10584, "src": "25:29:27", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/common/DepositableStorage.sol", "file": "./DepositableStorage.sol", "id": 10587, "nodeType": "ImportDirective", "scope": 10623, "sourceUnit": 10655, "src": "55:34:27", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 10588, "name": "DepositableStorage", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 10654, "src": "129:18:27", "typeDescriptions": { "typeIdentifier": "t_contract$_DepositableStorage_$10654", "typeString": "contract DepositableStorage" } }, "id": 10589, "nodeType": "InheritanceSpecifier", "src": "129:18:27" }, { "arguments": null, "baseName": { "contractScope": null, "id": 10590, "name": "DelegateProxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 10583, "src": "149:13:27", "typeDescriptions": { "typeIdentifier": "t_contract$_DelegateProxy_$10583", "typeString": "contract DelegateProxy" } }, "id": 10591, "nodeType": "InheritanceSpecifier", "src": "149:13:27" } ], "contractDependencies": [ 10583, 10654, 10838, 14225 ], "contractKind": "contract", "documentation": null, "fullyImplemented": false, "id": 10622, "linearizedBaseContracts": [ 10622, 10583, 10838, 14225, 10654 ], "name": "DepositableDelegateProxy", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 10597, "name": "ProxyDeposit", "nodeType": "EventDefinition", "parameters": { "id": 10596, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 10593, "indexed": false, "name": "sender", "nodeType": "VariableDeclaration", "scope": 10597, "src": "188:14:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 10592, "name": "address", "nodeType": "ElementaryTypeName", "src": "188:7:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 10595, "indexed": false, "name": "value", "nodeType": "VariableDeclaration", "scope": 10597, "src": "204:13:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 10594, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "204:7:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "187:31:27" }, "src": "169:50:27" }, { "body": { "id": 10620, "nodeType": "Block", "src": "254:1897:27", "statements": [ { "assignments": [ 10601 ], "declarations": [ { "constant": false, "id": 10601, "name": "forwardGasThreshold", "nodeType": "VariableDeclaration", "scope": 10621, "src": "264:27:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 10600, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "264:7:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 10603, "initialValue": { "argumentTypes": null, "id": 10602, "name": "FWD_GAS_LIMIT", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10563, "src": "294:13:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "264:43:27" }, { "assignments": [ 10605 ], "declarations": [ { "constant": false, "id": 10605, "name": "isDepositablePosition", "nodeType": "VariableDeclaration", "scope": 10621, "src": "317:29:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 10604, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "317:7:27", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "id": 10607, "initialValue": { "argumentTypes": null, "id": 10606, "name": "DEPOSITABLE_POSITION", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10631, "src": "349:20:27", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "VariableDeclarationStatement", "src": "317:52:27" }, { "externalReferences": [ { "forwardGasThreshold": { "declaration": 10601, "isOffset": false, "isSlot": false, "src": "824:19:27", "valueSize": 1 } }, { "isDepositablePosition": { "declaration": 10605, "isOffset": false, "isSlot": false, "src": "1078:21:27", "valueSize": 1 } } ], "id": 10608, "nodeType": "InlineAssembly", "operations": "{\n if lt(gas(), forwardGasThreshold)\n {\n if and(and(sload(isDepositablePosition), iszero(calldatasize())), gt(callvalue(), 0))\n {\n let logData := mload(0x40)\n mstore(logData, caller())\n mstore(add(logData, 0x20), callvalue())\n log1(logData, 0x40, 0x15eeaa57c7bd188c1388020bcadc2c436ec60d647d36ef5b9eb3c742217ddee1)\n stop()\n }\n revert(0, 0)\n }\n}", "src": "609:1469:27" }, { "assignments": [ 10610 ], "declarations": [ { "constant": false, "id": 10610, "name": "target", "nodeType": "VariableDeclaration", "scope": 10621, "src": "2071:14:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 10609, "name": "address", "nodeType": "ElementaryTypeName", "src": "2071:7:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "id": 10613, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 10611, "name": "implementation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14224, "src": "2088:14:27", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 10612, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2088:16:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "VariableDeclarationStatement", "src": "2071:33:27" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 10615, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10610, "src": "2127:6:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 10616, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 15153, "src": "2135:3:27", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 10617, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "data", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2135:8:27", "typeDescriptions": { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } ], "id": 10614, "name": "delegatedFwd", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 10582, "src": "2114:12:27", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$returns$__$", "typeString": "function (address,bytes memory)" } }, "id": 10618, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2114:30:27", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 10619, "nodeType": "ExpressionStatement", "src": "2114:30:27" } ] }, "documentation": null, "id": 10621, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 10598, "nodeType": "ParameterList", "parameters": [], "src": "234:2:27" }, "payable": true, "returnParameters": { "id": 10599, "nodeType": "ParameterList", "parameters": [], "src": "254:0:27" }, "scope": 10622, "src": "225:1926:27", "stateMutability": "payable", "superFunction": null, "visibility": "external" } ], "scope": 10623, "src": "92:2061:27" } ], "src": "0:2154:27" }, "compiler": { "name": "solc", "version": "0.4.24+commit.e67f0147.Emscripten.clang" }, "networks": {}, "schemaVersion": "2.0.1", "updatedAt": "2019-09-04T11:02:55.761Z" }