UNPKG

@daostack/upgrades

Version:
1,069 lines (1,068 loc) 36.2 kB
{ "fileName": "StorageMocks2.sol", "contractName": "StorageMockChainA1", "source": "pragma solidity ^0.6.0;\n// SPDX-License-Identifier: MIT\n\nimport \"./StorageMocks.sol\";\nimport \"mock-dependency/contracts/DependencyStorageMock.sol\";\n\ncontract StorageMockWithReferences {\n StorageMockWithEnums.MyEnum internal my_enum;\n StorageMockWithStructs.MyStruct internal my_struct;\n SimpleStorageMock internal my_contract;\n}\n\ncontract StorageMockWithNodeModulesReferences {\n DependencyStorageMock.MyEnum internal my_enum;\n DependencyStorageMock.MyStruct internal my_struct;\n DependencyStorageMock internal my_contract;\n}\n\ncontract StorageMockChainBase {\n uint256 internal base;\n}\n\ncontract StorageMockChainA1 is StorageMockChainBase {\n uint256 internal a1;\n uint256 internal a2;\n}\n\ncontract StorageMockChainA2 is StorageMockChainA1 {\n uint256 public a3;\n uint256 public a4;\n}\n\ncontract StorageMockChainB is StorageMockChainBase {\n uint256 internal b1;\n uint256 internal b2;\n}\n\ncontract StorageMockChainChild is StorageMockChainA2, StorageMockChainB {\n uint256 internal child;\n\n function slots() public pure returns(uint256 baseSlot, uint256 a1Slot, uint256 a3Slot, uint256 b1Slot, uint256 childSlot) {\n assembly {\n baseSlot := base_slot\n a1Slot := a1_slot\n a3Slot := a3_slot\n b1Slot := b1_slot\n childSlot := child_slot\n }\n }\n}", "sourcePath": "contracts/mocks/StorageMocks2.sol", "sourceMap": "592:101:19:-:0;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "592:101:19:-:0;;;;;;;;;;;", "abi": [], "ast": { "absolutePath": "contracts/mocks/StorageMocks2.sol", "exportedSymbols": { "StorageMockChainA1": [ 4815 ], "StorageMockChainA2": [ 4822 ], "StorageMockChainB": [ 4829 ], "StorageMockChainBase": [ 4808 ], "StorageMockChainChild": [ 4851 ], "StorageMockWithNodeModulesReferences": [ 4805 ], "StorageMockWithReferences": [ 4798 ] }, "id": 4852, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 4789, "literals": [ "solidity", "^", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:19" }, { "absolutePath": "contracts/mocks/StorageMocks.sol", "file": "./StorageMocks.sol", "id": 4790, "nodeType": "ImportDirective", "scope": 4852, "sourceUnit": 4788, "src": "57:28:19", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "mock-dependency/contracts/DependencyStorageMock.sol", "file": "mock-dependency/contracts/DependencyStorageMock.sol", "id": 4791, "nodeType": "ImportDirective", "scope": 4852, "sourceUnit": 6797, "src": "86:61:19", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4798, "linearizedBaseContracts": [ 4798 ], "name": "StorageMockWithReferences", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 4793, "mutability": "mutable", "name": "my_enum", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4798, "src": "188:44:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_enum$_MyEnum_$4741", "typeString": "enum StorageMockWithEnums.MyEnum" }, "typeName": { "contractScope": null, "id": 4792, "name": "StorageMockWithEnums.MyEnum", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4741, "src": "188:27:19", "typeDescriptions": { "typeIdentifier": "t_enum$_MyEnum_$4741", "typeString": "enum StorageMockWithEnums.MyEnum" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4795, "mutability": "mutable", "name": "my_struct", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4798, "src": "236:50:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_MyStruct_$4724_storage", "typeString": "struct StorageMockWithStructs.MyStruct" }, "typeName": { "contractScope": null, "id": 4794, "name": "StorageMockWithStructs.MyStruct", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4724, "src": "236:31:19", "typeDescriptions": { "typeIdentifier": "t_struct$_MyStruct_$4724_storage_ptr", "typeString": "struct StorageMockWithStructs.MyStruct" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4797, "mutability": "mutable", "name": "my_contract", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4798, "src": "290:38:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_SimpleStorageMock_$4603", "typeString": "contract SimpleStorageMock" }, "typeName": { "contractScope": null, "id": 4796, "name": "SimpleStorageMock", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4603, "src": "290:17:19", "typeDescriptions": { "typeIdentifier": "t_contract$_SimpleStorageMock_$4603", "typeString": "contract SimpleStorageMock" } }, "value": null, "visibility": "internal" } ], "scope": 4852, "src": "149:182:19" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4805, "linearizedBaseContracts": [ 4805 ], "name": "StorageMockWithNodeModulesReferences", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 4800, "mutability": "mutable", "name": "my_enum", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4805, "src": "383:45:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_enum$_MyEnum_$6792", "typeString": "enum DependencyStorageMock.MyEnum" }, "typeName": { "contractScope": null, "id": 4799, "name": "DependencyStorageMock.MyEnum", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 6792, "src": "383:28:19", "typeDescriptions": { "typeIdentifier": "t_enum$_MyEnum_$6792", "typeString": "enum DependencyStorageMock.MyEnum" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4802, "mutability": "mutable", "name": "my_struct", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4805, "src": "432:49:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_MyStruct_$6795_storage", "typeString": "struct DependencyStorageMock.MyStruct" }, "typeName": { "contractScope": null, "id": 4801, "name": "DependencyStorageMock.MyStruct", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 6795, "src": "432:30:19", "typeDescriptions": { "typeIdentifier": "t_struct$_MyStruct_$6795_storage_ptr", "typeString": "struct DependencyStorageMock.MyStruct" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4804, "mutability": "mutable", "name": "my_contract", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4805, "src": "485:42:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_DependencyStorageMock_$6796", "typeString": "contract DependencyStorageMock" }, "typeName": { "contractScope": null, "id": 4803, "name": "DependencyStorageMock", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 6796, "src": "485:21:19", "typeDescriptions": { "typeIdentifier": "t_contract$_DependencyStorageMock_$6796", "typeString": "contract DependencyStorageMock" } }, "value": null, "visibility": "internal" } ], "scope": 4852, "src": "333:197:19" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4808, "linearizedBaseContracts": [ 4808 ], "name": "StorageMockChainBase", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 4807, "mutability": "mutable", "name": "base", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4808, "src": "566:21:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4806, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "566:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "scope": 4852, "src": "532:58:19" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4809, "name": "StorageMockChainBase", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4808, "src": "623:20:19", "typeDescriptions": { "typeIdentifier": "t_contract$_StorageMockChainBase_$4808", "typeString": "contract StorageMockChainBase" } }, "id": 4810, "nodeType": "InheritanceSpecifier", "src": "623:20:19" } ], "contractDependencies": [ 4808 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4815, "linearizedBaseContracts": [ 4815, 4808 ], "name": "StorageMockChainA1", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 4812, "mutability": "mutable", "name": "a1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4815, "src": "648:19:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4811, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "648:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4814, "mutability": "mutable", "name": "a2", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4815, "src": "671:19:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4813, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "671:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "scope": 4852, "src": "592:101:19" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4816, "name": "StorageMockChainA1", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4815, "src": "726:18:19", "typeDescriptions": { "typeIdentifier": "t_contract$_StorageMockChainA1_$4815", "typeString": "contract StorageMockChainA1" } }, "id": 4817, "nodeType": "InheritanceSpecifier", "src": "726:18:19" } ], "contractDependencies": [ 4808, 4815 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4822, "linearizedBaseContracts": [ 4822, 4815, 4808 ], "name": "StorageMockChainA2", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "9426eef8", "id": 4819, "mutability": "mutable", "name": "a3", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4822, "src": "749:17:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4818, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "749:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "f74ea418", "id": 4821, "mutability": "mutable", "name": "a4", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4822, "src": "770:17:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4820, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "770:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" } ], "scope": 4852, "src": "695:95:19" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4823, "name": "StorageMockChainBase", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4808, "src": "822:20:19", "typeDescriptions": { "typeIdentifier": "t_contract$_StorageMockChainBase_$4808", "typeString": "contract StorageMockChainBase" } }, "id": 4824, "nodeType": "InheritanceSpecifier", "src": "822:20:19" } ], "contractDependencies": [ 4808 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4829, "linearizedBaseContracts": [ 4829, 4808 ], "name": "StorageMockChainB", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 4826, "mutability": "mutable", "name": "b1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4829, "src": "847:19:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4825, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "847:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4828, "mutability": "mutable", "name": "b2", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4829, "src": "870:19:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4827, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "870:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "scope": 4852, "src": "792:100:19" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4830, "name": "StorageMockChainA2", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4822, "src": "928:18:19", "typeDescriptions": { "typeIdentifier": "t_contract$_StorageMockChainA2_$4822", "typeString": "contract StorageMockChainA2" } }, "id": 4831, "nodeType": "InheritanceSpecifier", "src": "928:18:19" }, { "arguments": null, "baseName": { "contractScope": null, "id": 4832, "name": "StorageMockChainB", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4829, "src": "948:17:19", "typeDescriptions": { "typeIdentifier": "t_contract$_StorageMockChainB_$4829", "typeString": "contract StorageMockChainB" } }, "id": 4833, "nodeType": "InheritanceSpecifier", "src": "948:17:19" } ], "contractDependencies": [ 4808, 4815, 4822, 4829 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4851, "linearizedBaseContracts": [ 4851, 4829, 4822, 4815, 4808 ], "name": "StorageMockChainChild", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 4835, "mutability": "mutable", "name": "child", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4851, "src": "970:22:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4834, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "970:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "body": { "id": 4849, "nodeType": "Block", "src": "1119:156:19", "statements": [ { "AST": { "nodeType": "YulBlock", "src": "1134:137:19", "statements": [ { "nodeType": "YulAssignment", "src": "1142:21:19", "value": { "name": "base_slot", "nodeType": "YulIdentifier", "src": "1154:9:19" }, "variableNames": [ { "name": "baseSlot", "nodeType": "YulIdentifier", "src": "1142:8:19" } ] }, { "nodeType": "YulAssignment", "src": "1170:17:19", "value": { "name": "a1_slot", "nodeType": "YulIdentifier", "src": "1180:7:19" }, "variableNames": [ { "name": "a1Slot", "nodeType": "YulIdentifier", "src": "1170:6:19" } ] }, { "nodeType": "YulAssignment", "src": "1194:17:19", "value": { "name": "a3_slot", "nodeType": "YulIdentifier", "src": "1204:7:19" }, "variableNames": [ { "name": "a3Slot", "nodeType": "YulIdentifier", "src": "1194:6:19" } ] }, { "nodeType": "YulAssignment", "src": "1218:17:19", "value": { "name": "b1_slot", "nodeType": "YulIdentifier", "src": "1228:7:19" }, "variableNames": [ { "name": "b1Slot", "nodeType": "YulIdentifier", "src": "1218:6:19" } ] }, { "nodeType": "YulAssignment", "src": "1242:23:19", "value": { "name": "child_slot", "nodeType": "YulIdentifier", "src": "1255:10:19" }, "variableNames": [ { "name": "childSlot", "nodeType": "YulIdentifier", "src": "1242:9:19" } ] } ] }, "evmVersion": "constantinople", "externalReferences": [ { "declaration": 4840, "isOffset": false, "isSlot": false, "src": "1170:6:19", "valueSize": 1 }, { "declaration": 4812, "isOffset": false, "isSlot": true, "src": "1180:7:19", "valueSize": 1 }, { "declaration": 4842, "isOffset": false, "isSlot": false, "src": "1194:6:19", "valueSize": 1 }, { "declaration": 4819, "isOffset": false, "isSlot": true, "src": "1204:7:19", "valueSize": 1 }, { "declaration": 4844, "isOffset": false, "isSlot": false, "src": "1218:6:19", "valueSize": 1 }, { "declaration": 4826, "isOffset": false, "isSlot": true, "src": "1228:7:19", "valueSize": 1 }, { "declaration": 4838, "isOffset": false, "isSlot": false, "src": "1142:8:19", "valueSize": 1 }, { "declaration": 4807, "isOffset": false, "isSlot": true, "src": "1154:9:19", "valueSize": 1 }, { "declaration": 4846, "isOffset": false, "isSlot": false, "src": "1242:9:19", "valueSize": 1 }, { "declaration": 4835, "isOffset": false, "isSlot": true, "src": "1255:10:19", "valueSize": 1 } ], "id": 4848, "nodeType": "InlineAssembly", "src": "1125:146:19" } ] }, "documentation": null, "functionSelector": "48547d69", "id": 4850, "implemented": true, "kind": "function", "modifiers": [], "name": "slots", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 4836, "nodeType": "ParameterList", "parameters": [], "src": "1011:2:19" }, "returnParameters": { "id": 4847, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4838, "mutability": "mutable", "name": "baseSlot", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4850, "src": "1034:16:19", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4837, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1034:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4840, "mutability": "mutable", "name": "a1Slot", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4850, "src": "1052:14:19", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4839, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1052:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4842, "mutability": "mutable", "name": "a3Slot", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4850, "src": "1068:14:19", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4841, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1068:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4844, "mutability": "mutable", "name": "b1Slot", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4850, "src": "1084:14:19", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4843, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1084:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4846, "mutability": "mutable", "name": "childSlot", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4850, "src": "1100:17:19", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4845, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1100:7:19", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1033:85:19" }, "scope": 4851, "src": "997:278:19", "stateMutability": "pure", "virtual": false, "visibility": "public" } ], "scope": 4852, "src": "894:383:19" } ], "src": "0:1277:19" }, "bytecode": "0x608060405234801560105760006000fd5b506015565b60488060226000396000f3fe608060405260043610600c575b60006000fdfea2646970667358221220e80f843df96c4b8355f646c9869a1b6f24ffdafc60616ed54a03debf117ad20d64736f6c634300060a0033", "deployedBytecode": "0x608060405260043610600c575b60006000fdfea2646970667358221220e80f843df96c4b8355f646c9869a1b6f24ffdafc60616ed54a03debf117ad20d64736f6c634300060a0033", "compiler": { "name": "solc", "version": "0.6.10+commit.00c0fcaf.Emscripten.clang", "optimizer": {}, "evmVersion": "constantinople" } }