{
  "contractName": "DelegateProxy",
  "abi": [],
  "bytecode": "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a723058206d0fe350a230500c8d42b0961f3c9b9c7309033a29ded4037e675f40eec32d240029",
  "deployedBytecode": "0x6060604052600080fd00a165627a7a723058206d0fe350a230500c8d42b0961f3c9b9c7309033a29ded4037e675f40eec32d240029",
  "sourceMap": "26:1091:22:-;;;;;;;;;;;;;;;;;",
  "deployedSourceMap": "26:1091:22:-;;;;;",
  "source": "pragma solidity 0.4.18;\n\n\ncontract DelegateProxy {\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        assembly {\n            let result := delegatecall(sub(gas, 10000), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)\n            let size := returndatasize\n\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    function isContract(address _target) internal view returns (bool) {\n        uint256 size;\n        assembly { size := extcodesize(_target) }\n        return size > 0;\n    }\n}\n",
  "sourcePath": "@aragon/os/contracts/common/DelegateProxy.sol",
  "ast": {
    "attributes": {
      "absolutePath": "@aragon/os/contracts/common/DelegateProxy.sol",
      "exportedSymbols": {
        "DelegateProxy": [
          7015
        ]
      }
    },
    "children": [
      {
        "attributes": {
          "literals": [
            "solidity",
            "0.4",
            ".18"
          ]
        },
        "id": 6983,
        "name": "PragmaDirective",
        "src": "0:23:22"
      },
      {
        "attributes": {
          "baseContracts": [
            null
          ],
          "contractDependencies": [
            null
          ],
          "contractKind": "contract",
          "documentation": null,
          "fullyImplemented": true,
          "linearizedBaseContracts": [
            7015
          ],
          "name": "DelegateProxy",
          "scope": 7016
        },
        "children": [
          {
            "attributes": {
              "constant": false,
              "implemented": true,
              "isConstructor": false,
              "modifiers": [
                null
              ],
              "name": "delegatedFwd",
              "payable": false,
              "scope": 7015,
              "stateMutability": "nonpayable",
              "superFunction": null,
              "visibility": "internal"
            },
            "children": [
              {
                "children": [
                  {
                    "attributes": {
                      "constant": false,
                      "name": "_dst",
                      "scope": 6998,
                      "stateVariable": false,
                      "storageLocation": "default",
                      "type": "address",
                      "value": null,
                      "visibility": "internal"
                    },
                    "children": [
                      {
                        "attributes": {
                          "name": "address",
                          "type": "address"
                        },
                        "id": 6984,
                        "name": "ElementaryTypeName",
                        "src": "333:7:22"
                      }
                    ],
                    "id": 6985,
                    "name": "VariableDeclaration",
                    "src": "333:12:22"
                  },
                  {
                    "attributes": {
                      "constant": false,
                      "name": "_calldata",
                      "scope": 6998,
                      "stateVariable": false,
                      "storageLocation": "default",
                      "type": "bytes memory",
                      "value": null,
                      "visibility": "internal"
                    },
                    "children": [
                      {
                        "attributes": {
                          "name": "bytes",
                          "type": "bytes storage pointer"
                        },
                        "id": 6986,
                        "name": "ElementaryTypeName",
                        "src": "347:5:22"
                      }
                    ],
                    "id": 6987,
                    "name": "VariableDeclaration",
                    "src": "347:15:22"
                  }
                ],
                "id": 6988,
                "name": "ParameterList",
                "src": "332:31:22"
              },
              {
                "attributes": {
                  "parameters": [
                    null
                  ]
                },
                "children": [],
                "id": 6989,
                "name": "ParameterList",
                "src": "373:0:22"
              },
              {
                "children": [
                  {
                    "children": [
                      {
                        "attributes": {
                          "argumentTypes": null,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "isStructConstructorCall": false,
                          "lValueRequested": false,
                          "names": [
                            null
                          ],
                          "type": "tuple()",
                          "type_conversion": false
                        },
                        "children": [
                          {
                            "attributes": {
                              "argumentTypes": [
                                {
                                  "typeIdentifier": "t_bool",
                                  "typeString": "bool"
                                }
                              ],
                              "overloadedDeclarations": [
                                null
                              ],
                              "referencedDeclaration": 12593,
                              "type": "function (bool) pure",
                              "value": "require"
                            },
                            "id": 6990,
                            "name": "Identifier",
                            "src": "383:7:22"
                          },
                          {
                            "attributes": {
                              "argumentTypes": null,
                              "isConstant": false,
                              "isLValue": false,
                              "isPure": false,
                              "isStructConstructorCall": false,
                              "lValueRequested": false,
                              "names": [
                                null
                              ],
                              "type": "bool",
                              "type_conversion": false
                            },
                            "children": [
                              {
                                "attributes": {
                                  "argumentTypes": [
                                    {
                                      "typeIdentifier": "t_address",
                                      "typeString": "address"
                                    }
                                  ],
                                  "overloadedDeclarations": [
                                    null
                                  ],
                                  "referencedDeclaration": 7014,
                                  "type": "function (address) view returns (bool)",
                                  "value": "isContract"
                                },
                                "id": 6991,
                                "name": "Identifier",
                                "src": "391:10:22"
                              },
                              {
                                "attributes": {
                                  "argumentTypes": null,
                                  "overloadedDeclarations": [
                                    null
                                  ],
                                  "referencedDeclaration": 6985,
                                  "type": "address",
                                  "value": "_dst"
                                },
                                "id": 6992,
                                "name": "Identifier",
                                "src": "402:4:22"
                              }
                            ],
                            "id": 6993,
                            "name": "FunctionCall",
                            "src": "391:16:22"
                          }
                        ],
                        "id": 6994,
                        "name": "FunctionCall",
                        "src": "383:25:22"
                      }
                    ],
                    "id": 6995,
                    "name": "ExpressionStatement",
                    "src": "383:25:22"
                  },
                  {
                    "attributes": {
                      "externalReferences": [
                        {
                          "_calldata": {
                            "declaration": 6987,
                            "isOffset": false,
                            "isSlot": false,
                            "src": "495:9:22",
                            "valueSize": 1
                          }
                        },
                        {
                          "_calldata": {
                            "declaration": 6987,
                            "isOffset": false,
                            "isSlot": false,
                            "src": "519:9:22",
                            "valueSize": 1
                          }
                        },
                        {
                          "_dst": {
                            "declaration": 6985,
                            "isOffset": false,
                            "isSlot": false,
                            "src": "485:4:22",
                            "valueSize": 1
                          }
                        }
                      ],
                      "operations": "{\n    let result := delegatecall(sub(gas, 10000), _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}"
                    },
                    "children": [],
                    "id": 6996,
                    "name": "InlineAssembly",
                    "src": "418:521:22"
                  }
                ],
                "id": 6997,
                "name": "Block",
                "src": "373:566:22"
              }
            ],
            "id": 6998,
            "name": "FunctionDefinition",
            "src": "311:628:22"
          },
          {
            "attributes": {
              "constant": true,
              "implemented": true,
              "isConstructor": false,
              "modifiers": [
                null
              ],
              "name": "isContract",
              "payable": false,
              "scope": 7015,
              "stateMutability": "view",
              "superFunction": null,
              "visibility": "internal"
            },
            "children": [
              {
                "children": [
                  {
                    "attributes": {
                      "constant": false,
                      "name": "_target",
                      "scope": 7014,
                      "stateVariable": false,
                      "storageLocation": "default",
                      "type": "address",
                      "value": null,
                      "visibility": "internal"
                    },
                    "children": [
                      {
                        "attributes": {
                          "name": "address",
                          "type": "address"
                        },
                        "id": 6999,
                        "name": "ElementaryTypeName",
                        "src": "965:7:22"
                      }
                    ],
                    "id": 7000,
                    "name": "VariableDeclaration",
                    "src": "965:15:22"
                  }
                ],
                "id": 7001,
                "name": "ParameterList",
                "src": "964:17:22"
              },
              {
                "children": [
                  {
                    "attributes": {
                      "constant": false,
                      "name": "",
                      "scope": 7014,
                      "stateVariable": false,
                      "storageLocation": "default",
                      "type": "bool",
                      "value": null,
                      "visibility": "internal"
                    },
                    "children": [
                      {
                        "attributes": {
                          "name": "bool",
                          "type": "bool"
                        },
                        "id": 7002,
                        "name": "ElementaryTypeName",
                        "src": "1005:4:22"
                      }
                    ],
                    "id": 7003,
                    "name": "VariableDeclaration",
                    "src": "1005:4:22"
                  }
                ],
                "id": 7004,
                "name": "ParameterList",
                "src": "1004:6:22"
              },
              {
                "children": [
                  {
                    "attributes": {
                      "assignments": [
                        null
                      ],
                      "initialValue": null
                    },
                    "children": [
                      {
                        "attributes": {
                          "constant": false,
                          "name": "size",
                          "scope": 7014,
                          "stateVariable": false,
                          "storageLocation": "default",
                          "type": "uint256",
                          "value": null,
                          "visibility": "internal"
                        },
                        "children": [
                          {
                            "attributes": {
                              "name": "uint256",
                              "type": "uint256"
                            },
                            "id": 7005,
                            "name": "ElementaryTypeName",
                            "src": "1021:7:22"
                          }
                        ],
                        "id": 7006,
                        "name": "VariableDeclaration",
                        "src": "1021:12:22"
                      }
                    ],
                    "id": 7007,
                    "name": "VariableDeclarationStatement",
                    "src": "1021:12:22"
                  },
                  {
                    "attributes": {
                      "externalReferences": [
                        {
                          "size": {
                            "declaration": 7006,
                            "isOffset": false,
                            "isSlot": false,
                            "src": "1054:4:22",
                            "valueSize": 1
                          }
                        },
                        {
                          "_target": {
                            "declaration": 7000,
                            "isOffset": false,
                            "isSlot": false,
                            "src": "1074:7:22",
                            "valueSize": 1
                          }
                        }
                      ],
                      "operations": "{\n    size := extcodesize(_target)\n}"
                    },
                    "children": [],
                    "id": 7008,
                    "name": "InlineAssembly",
                    "src": "1043:56:22"
                  },
                  {
                    "attributes": {
                      "functionReturnParameters": 7004
                    },
                    "children": [
                      {
                        "attributes": {
                          "argumentTypes": null,
                          "commonType": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          },
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "operator": ">",
                          "type": "bool"
                        },
                        "children": [
                          {
                            "attributes": {
                              "argumentTypes": null,
                              "overloadedDeclarations": [
                                null
                              ],
                              "referencedDeclaration": 7006,
                              "type": "uint256",
                              "value": "size"
                            },
                            "id": 7009,
                            "name": "Identifier",
                            "src": "1100:4:22"
                          },
                          {
                            "attributes": {
                              "argumentTypes": null,
                              "hexvalue": "30",
                              "isConstant": false,
                              "isLValue": false,
                              "isPure": true,
                              "lValueRequested": false,
                              "subdenomination": null,
                              "token": "number",
                              "type": "int_const 0",
                              "value": "0"
                            },
                            "id": 7010,
                            "name": "Literal",
                            "src": "1107:1:22"
                          }
                        ],
                        "id": 7011,
                        "name": "BinaryOperation",
                        "src": "1100:8:22"
                      }
                    ],
                    "id": 7012,
                    "name": "Return",
                    "src": "1093:15:22"
                  }
                ],
                "id": 7013,
                "name": "Block",
                "src": "1011:104:22"
              }
            ],
            "id": 7014,
            "name": "FunctionDefinition",
            "src": "945:170:22"
          }
        ],
        "id": 7015,
        "name": "ContractDefinition",
        "src": "26:1091:22"
      }
    ],
    "id": 7016,
    "name": "SourceUnit",
    "src": "0:1118:22"
  },
  "compiler": {
    "name": "solc",
    "version": "0.4.18+commit.9cf6e910.Emscripten.clang"
  },
  "networks": {},
  "schemaVersion": "1.0.1",
  "updatedAt": "2018-03-14T08:41:25.089Z"
}