web3 7.0.0b1__py3-none-any.whl → 7.0.0b3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. ens/async_ens.py +6 -8
  2. ens/ens.py +6 -6
  3. ens/utils.py +18 -16
  4. web3/_utils/abi.py +9 -15
  5. web3/_utils/events.py +15 -6
  6. web3/_utils/math.py +12 -14
  7. web3/_utils/method_formatters.py +7 -0
  8. web3/_utils/module_testing/eth_module.py +67 -6
  9. web3/_utils/module_testing/module_testing_utils.py +2 -2
  10. web3/_utils/request.py +1 -1
  11. web3/_utils/rpc_abi.py +1 -0
  12. web3/_utils/transactions.py +4 -0
  13. web3/contract/base_contract.py +1 -1
  14. web3/datastructures.py +7 -7
  15. web3/eth/async_eth.py +20 -2
  16. web3/eth/eth.py +13 -1
  17. web3/exceptions.py +11 -0
  18. web3/main.py +4 -30
  19. web3/manager.py +12 -13
  20. web3/middleware/__init__.py +9 -8
  21. web3/module.py +1 -1
  22. web3/providers/async_base.py +6 -6
  23. web3/providers/base.py +8 -8
  24. web3/providers/eth_tester/main.py +16 -20
  25. web3/providers/ipc.py +1 -1
  26. web3/providers/legacy_websocket.py +1 -1
  27. web3/providers/persistent/persistent.py +2 -2
  28. web3/providers/persistent/request_processor.py +3 -5
  29. web3/tools/benchmark/main.py +2 -2
  30. web3/types.py +4 -0
  31. web3/utils/caching.py +2 -4
  32. {web3-7.0.0b1.dist-info → web3-7.0.0b3.dist-info}/METADATA +3 -9
  33. web3-7.0.0b3.dist-info/RECORD +168 -0
  34. {web3-7.0.0b1.dist-info → web3-7.0.0b3.dist-info}/WHEEL +1 -1
  35. {web3-7.0.0b1.dist-info → web3-7.0.0b3.dist-info}/top_level.txt +0 -1
  36. ethpm/__init__.py +0 -20
  37. ethpm/_utils/__init__.py +0 -0
  38. ethpm/_utils/backend.py +0 -93
  39. ethpm/_utils/cache.py +0 -44
  40. ethpm/_utils/chains.py +0 -119
  41. ethpm/_utils/contract.py +0 -35
  42. ethpm/_utils/deployments.py +0 -145
  43. ethpm/_utils/ipfs.py +0 -116
  44. ethpm/_utils/protobuf/__init__.py +0 -0
  45. ethpm/_utils/protobuf/ipfs_file_pb2.py +0 -33
  46. ethpm/_utils/registry.py +0 -29
  47. ethpm/assets/__init__.py +0 -0
  48. ethpm/assets/ens/v3.json +0 -1
  49. ethpm/assets/escrow/with_bytecode_v3.json +0 -1
  50. ethpm/assets/ipfs_file.proto +0 -32
  51. ethpm/assets/owned/output_v3.json +0 -1
  52. ethpm/assets/owned/with_contract_type_v3.json +0 -1
  53. ethpm/assets/registry/contracts/Authority.sol +0 -156
  54. ethpm/assets/registry/contracts/IndexedOrderedSetLib.sol +0 -106
  55. ethpm/assets/registry/contracts/PackageDB.sol +0 -225
  56. ethpm/assets/registry/contracts/PackageRegistry.sol +0 -361
  57. ethpm/assets/registry/contracts/PackageRegistryInterface.sol +0 -97
  58. ethpm/assets/registry/contracts/ReleaseDB.sol +0 -309
  59. ethpm/assets/registry/contracts/ReleaseValidator.sol +0 -152
  60. ethpm/assets/registry/solc_input.json +0 -1
  61. ethpm/assets/registry/solc_output.json +0 -1
  62. ethpm/assets/registry/v3.json +0 -1
  63. ethpm/assets/safe-math-lib/v3-strict-no-deployments.json +0 -1
  64. ethpm/assets/simple-registry/contracts/Ownable.sol +0 -63
  65. ethpm/assets/simple-registry/contracts/PackageRegistry.sol +0 -373
  66. ethpm/assets/simple-registry/contracts/PackageRegistryInterface.sol +0 -96
  67. ethpm/assets/simple-registry/solc_input.json +0 -33
  68. ethpm/assets/simple-registry/solc_output.json +0 -1
  69. ethpm/assets/simple-registry/v3.json +0 -1
  70. ethpm/assets/standard-token/output_v3.json +0 -1
  71. ethpm/assets/standard-token/with_bytecode_v3.json +0 -1
  72. ethpm/assets/vyper_registry/0.1.0.json +0 -1
  73. ethpm/assets/vyper_registry/registry.vy +0 -216
  74. ethpm/assets/vyper_registry/registry_with_delete.vy +0 -244
  75. ethpm/backends/__init__.py +0 -0
  76. ethpm/backends/base.py +0 -43
  77. ethpm/backends/http.py +0 -108
  78. ethpm/backends/ipfs.py +0 -219
  79. ethpm/backends/registry.py +0 -154
  80. ethpm/constants.py +0 -17
  81. ethpm/contract.py +0 -187
  82. ethpm/dependencies.py +0 -58
  83. ethpm/deployments.py +0 -80
  84. ethpm/ethpm-spec/examples/escrow/1.0.0-pretty.json +0 -146
  85. ethpm/ethpm-spec/examples/escrow/1.0.0.json +0 -1
  86. ethpm/ethpm-spec/examples/escrow/contracts/Escrow.sol +0 -32
  87. ethpm/ethpm-spec/examples/escrow/contracts/SafeSendLib.sol +0 -20
  88. ethpm/ethpm-spec/examples/escrow/v3-pretty.json +0 -171
  89. ethpm/ethpm-spec/examples/escrow/v3.json +0 -1
  90. ethpm/ethpm-spec/examples/owned/1.0.0-pretty.json +0 -21
  91. ethpm/ethpm-spec/examples/owned/1.0.0.json +0 -1
  92. ethpm/ethpm-spec/examples/owned/contracts/Owned.sol +0 -12
  93. ethpm/ethpm-spec/examples/owned/v3-pretty.json +0 -27
  94. ethpm/ethpm-spec/examples/owned/v3.json +0 -1
  95. ethpm/ethpm-spec/examples/piper-coin/1.0.0-pretty.json +0 -31
  96. ethpm/ethpm-spec/examples/piper-coin/1.0.0.json +0 -1
  97. ethpm/ethpm-spec/examples/piper-coin/v3-pretty.json +0 -21
  98. ethpm/ethpm-spec/examples/piper-coin/v3.json +0 -1
  99. ethpm/ethpm-spec/examples/safe-math-lib/1.0.0-pretty.json +0 -85
  100. ethpm/ethpm-spec/examples/safe-math-lib/1.0.0.json +0 -1
  101. ethpm/ethpm-spec/examples/safe-math-lib/contracts/SafeMathLib.sol +0 -24
  102. ethpm/ethpm-spec/examples/safe-math-lib/v3-pretty.json +0 -117
  103. ethpm/ethpm-spec/examples/safe-math-lib/v3.json +0 -1
  104. ethpm/ethpm-spec/examples/standard-token/1.0.0-pretty.json +0 -55
  105. ethpm/ethpm-spec/examples/standard-token/1.0.0.json +0 -1
  106. ethpm/ethpm-spec/examples/standard-token/contracts/AbstractToken.sol +0 -20
  107. ethpm/ethpm-spec/examples/standard-token/contracts/StandardToken.sol +0 -84
  108. ethpm/ethpm-spec/examples/standard-token/v3-pretty.json +0 -460
  109. ethpm/ethpm-spec/examples/standard-token/v3.json +0 -1
  110. ethpm/ethpm-spec/examples/transferable/1.0.0-pretty.json +0 -21
  111. ethpm/ethpm-spec/examples/transferable/1.0.0.json +0 -1
  112. ethpm/ethpm-spec/examples/transferable/contracts/Transferable.sol +0 -14
  113. ethpm/ethpm-spec/examples/transferable/v3-pretty.json +0 -27
  114. ethpm/ethpm-spec/examples/transferable/v3.json +0 -1
  115. ethpm/ethpm-spec/examples/wallet/1.0.0-pretty.json +0 -120
  116. ethpm/ethpm-spec/examples/wallet/1.0.0.json +0 -1
  117. ethpm/ethpm-spec/examples/wallet/contracts/Wallet.sol +0 -41
  118. ethpm/ethpm-spec/examples/wallet/v3-pretty.json +0 -181
  119. ethpm/ethpm-spec/examples/wallet/v3.json +0 -1
  120. ethpm/ethpm-spec/examples/wallet-with-send/1.0.0-pretty.json +0 -135
  121. ethpm/ethpm-spec/examples/wallet-with-send/1.0.0.json +0 -1
  122. ethpm/ethpm-spec/examples/wallet-with-send/contracts/WalletWithSend.sol +0 -18
  123. ethpm/ethpm-spec/examples/wallet-with-send/v3-pretty.json +0 -207
  124. ethpm/ethpm-spec/examples/wallet-with-send/v3.json +0 -1
  125. ethpm/ethpm-spec/spec/package.spec.json +0 -379
  126. ethpm/ethpm-spec/spec/v3.spec.json +0 -483
  127. ethpm/exceptions.py +0 -68
  128. ethpm/package.py +0 -438
  129. ethpm/tools/__init__.py +0 -4
  130. ethpm/tools/builder.py +0 -930
  131. ethpm/tools/checker.py +0 -312
  132. ethpm/tools/get_manifest.py +0 -19
  133. ethpm/uri.py +0 -141
  134. ethpm/validation/__init__.py +0 -0
  135. ethpm/validation/manifest.py +0 -146
  136. ethpm/validation/misc.py +0 -39
  137. ethpm/validation/package.py +0 -80
  138. ethpm/validation/uri.py +0 -163
  139. web3/pm.py +0 -602
  140. web3/tools/__init__.py +0 -4
  141. web3/tools/pytest_ethereum/__init__.py +0 -0
  142. web3/tools/pytest_ethereum/_utils.py +0 -145
  143. web3/tools/pytest_ethereum/deployer.py +0 -48
  144. web3/tools/pytest_ethereum/exceptions.py +0 -22
  145. web3/tools/pytest_ethereum/linker.py +0 -128
  146. web3/tools/pytest_ethereum/plugins.py +0 -33
  147. web3-7.0.0b1.dist-info/RECORD +0 -280
  148. web3-7.0.0b1.dist-info/entry_points.txt +0 -2
  149. {web3-7.0.0b1.dist-info → web3-7.0.0b3.dist-info}/LICENSE +0 -0
@@ -1,156 +0,0 @@
1
- pragma solidity ^0.4.24;
2
- pragma experimental "v0.5.0";
3
-
4
-
5
- contract AuthorityInterface {
6
- function canCall(
7
- address callerAddress,
8
- address codeAddress,
9
- bytes4 sig
10
- )
11
- public
12
- view
13
- returns (bool);
14
- }
15
-
16
-
17
- contract AuthorizedInterface {
18
- address public owner;
19
- AuthorityInterface public authority;
20
-
21
- modifier auth {
22
- require(isAuthorized(),"escape:Authority:caller-not-authorized");
23
- _;
24
- }
25
-
26
- event OwnerUpdate(address indexed oldOwner, address indexed newOwner);
27
- event AuthorityUpdate(address indexed oldAuthority, address indexed newAuthority);
28
-
29
- function setOwner(address newOwner) public returns (bool);
30
-
31
- function setAuthority(AuthorityInterface newAuthority) public returns (bool);
32
-
33
- function isAuthorized() internal returns (bool);
34
- }
35
-
36
-
37
- contract Authorized is AuthorizedInterface {
38
- constructor() public {
39
- owner = msg.sender;
40
- emit OwnerUpdate(0x0, owner);
41
- }
42
-
43
- function setOwner(address newOwner)
44
- public
45
- auth
46
- returns (bool)
47
- {
48
- emit OwnerUpdate(owner, newOwner);
49
- owner = newOwner;
50
- return true;
51
- }
52
-
53
- function setAuthority(AuthorityInterface newAuthority)
54
- public
55
- auth
56
- returns (bool)
57
- {
58
- emit AuthorityUpdate(authority, newAuthority);
59
- authority = newAuthority;
60
- return true;
61
- }
62
-
63
- function isAuthorized() internal returns (bool) {
64
- if (msg.sender == owner) {
65
- return true;
66
- } else if (address(authority) == (0)) {
67
- return false;
68
- } else {
69
- return authority.canCall(msg.sender, this, msg.sig);
70
- }
71
- }
72
- }
73
-
74
-
75
- contract WhitelistAuthorityInterface is AuthorityInterface, AuthorizedInterface {
76
- event SetCanCall(
77
- address indexed callerAddress,
78
- address indexed codeAddress,
79
- bytes4 indexed sig,
80
- bool can
81
- );
82
-
83
- event SetAnyoneCanCall(
84
- address indexed codeAddress,
85
- bytes4 indexed sig,
86
- bool can
87
- );
88
-
89
- function setCanCall(
90
- address callerAddress,
91
- address codeAddress,
92
- bytes4 sig,
93
- bool can
94
- )
95
- public
96
- returns (bool);
97
-
98
- function setAnyoneCanCall(
99
- address codeAddress,
100
- bytes4 sig,
101
- bool can
102
- )
103
- public
104
- returns (bool);
105
- }
106
-
107
-
108
- contract WhitelistAuthority is WhitelistAuthorityInterface, Authorized {
109
- mapping (address => mapping (address => mapping (bytes4 => bool))) _canCall;
110
- mapping (address => mapping (bytes4 => bool)) _anyoneCanCall;
111
-
112
- function canCall(
113
- address callerAddress,
114
- address codeAddress,
115
- bytes4 sig
116
- )
117
- public
118
- view
119
- returns (bool)
120
- {
121
- if (_anyoneCanCall[codeAddress][sig]) {
122
- return true;
123
- } else {
124
- return _canCall[callerAddress][codeAddress][sig];
125
- }
126
- }
127
-
128
- function setCanCall(
129
- address callerAddress,
130
- address codeAddress,
131
- bytes4 sig,
132
- bool can
133
- )
134
- public
135
- auth
136
- returns (bool)
137
- {
138
- _canCall[callerAddress][codeAddress][sig] = can;
139
- emit SetCanCall(callerAddress, codeAddress, sig, can);
140
- return true;
141
- }
142
-
143
- function setAnyoneCanCall(
144
- address codeAddress,
145
- bytes4 sig,
146
- bool can
147
- )
148
- public
149
- auth
150
- returns (bool)
151
- {
152
- _anyoneCanCall[codeAddress][sig] = can;
153
- emit SetAnyoneCanCall(codeAddress, sig, can);
154
- return true;
155
- }
156
- }
@@ -1,106 +0,0 @@
1
- pragma solidity ^0.4.24;
2
- pragma experimental "v0.5.0";
3
-
4
- /// @title Library implementing an array type which allows O(1) lookups on values.
5
- /// @author Piper Merriam <pipermerriam@gmail.com>
6
- library IndexedOrderedSetLib {
7
- struct IndexedOrderedSet {
8
- bytes32[] _values;
9
- mapping (bytes32 => uint) _valueIndices;
10
- mapping (bytes32 => bool) _exists;
11
- }
12
-
13
- modifier requireValue(IndexedOrderedSet storage self, bytes32 value) {
14
- require(contains(self, value), "escape:IndexedOrderedSetLib:value-not-found");
15
- _;
16
- }
17
-
18
- /// @dev Returns the size of the set
19
- /// @param self The set
20
- function size(IndexedOrderedSet storage self)
21
- public
22
- view
23
- returns (uint)
24
- {
25
- return self._values.length;
26
- }
27
-
28
- /// @dev Returns boolean if the key is in the set
29
- /// @param self The set
30
- /// @param value The value to check
31
- function contains(IndexedOrderedSet storage self, bytes32 value)
32
- public
33
- view
34
- returns (bool)
35
- {
36
- return self._exists[value];
37
- }
38
-
39
- /// @dev Returns the index of the value in the set.
40
- /// @param self The set
41
- /// @param value The value to look up the index for.
42
- function indexOf(IndexedOrderedSet storage self, bytes32 value)
43
- public
44
- view
45
- requireValue(self, value)
46
- returns (uint)
47
- {
48
- return self._valueIndices[value];
49
- }
50
-
51
- /// @dev Removes the element at index idx from the set and returns it.
52
- /// @param self The set
53
- /// @param idx The index to remove and return.
54
- function pop(IndexedOrderedSet storage self, uint idx) public returns (bytes32) {
55
- bytes32 value = get(self, idx);
56
-
57
- if (idx != self._values.length - 1) {
58
- bytes32 movedValue = self._values[self._values.length - 1];
59
- self._values[idx] = movedValue;
60
- self._valueIndices[movedValue] = idx;
61
- }
62
- self._values.length -= 1;
63
-
64
- delete self._valueIndices[value];
65
- delete self._exists[value];
66
-
67
- return value;
68
- }
69
-
70
- /// @dev Removes the element at index idx from the set
71
- /// @param self The set
72
- /// @param value The value to remove from the set.
73
- function remove(IndexedOrderedSet storage self, bytes32 value)
74
- public
75
- requireValue(self, value)
76
- returns (bool)
77
- {
78
- uint idx = indexOf(self, value);
79
- pop(self, idx);
80
- return true;
81
- }
82
-
83
- /// @dev Retrieves the element at the provided index.
84
- /// @param self The set
85
- /// @param idx The index to retrieve.
86
- function get(IndexedOrderedSet storage self, uint idx)
87
- public
88
- view
89
- returns (bytes32)
90
- {
91
- return self._values[idx];
92
- }
93
-
94
- /// @dev Pushes the new value onto the set
95
- /// @param self The set
96
- /// @param value The value to push.
97
- function add(IndexedOrderedSet storage self, bytes32 value) public returns (bool) {
98
- if (contains(self, value)) return true;
99
-
100
- self._valueIndices[value] = self._values.length;
101
- self._values.push(value);
102
- self._exists[value] = true;
103
-
104
- return true;
105
- }
106
- }
@@ -1,225 +0,0 @@
1
- pragma solidity ^0.4.24;
2
- pragma experimental "v0.5.0";
3
-
4
- import {IndexedOrderedSetLib} from "./IndexedOrderedSetLib.sol";
5
- import {Authorized} from "./Authority.sol";
6
-
7
-
8
- /// @title Database contract for a package index package data.
9
- /// @author Tim Coulter <tim.coulter@consensys.net>, Piper Merriam <pipermerriam@gmail.com>
10
- contract PackageDB is Authorized {
11
- using IndexedOrderedSetLib for IndexedOrderedSetLib.IndexedOrderedSet;
12
-
13
- struct Package {
14
- bool exists;
15
- uint createdAt;
16
- uint updatedAt;
17
- string name;
18
- address owner;
19
- }
20
-
21
- // Package Data: (nameHash => value)
22
- mapping (bytes32 => Package) _recordedPackages;
23
- IndexedOrderedSetLib.IndexedOrderedSet _allPackageNameHashes;
24
-
25
- // Events
26
- event PackageReleaseAdd(bytes32 indexed nameHash, bytes32 indexed releaseHash);
27
- event PackageReleaseRemove(bytes32 indexed nameHash, bytes32 indexed releaseHash);
28
- event PackageCreate(bytes32 indexed nameHash);
29
- event PackageDelete(bytes32 indexed nameHash, string reason);
30
- event PackageOwnerUpdate(bytes32 indexed nameHash, address indexed oldOwner, address indexed newOwner);
31
-
32
- /*
33
- * Modifiers
34
- */
35
- modifier onlyIfPackageExists(bytes32 nameHash) {
36
- require(packageExists(nameHash), "escape:PackageDB:package-not-found");
37
- _;
38
- }
39
-
40
- //
41
- // +-------------+
42
- // | Write API |
43
- // +-------------+
44
- //
45
-
46
- /// @dev Creates or updates a release for a package. Returns success.
47
- /// @param name Package name
48
- function setPackage(string name)
49
- public
50
- auth
51
- returns (bool)
52
- {
53
- // Hash the name and the version for storing data
54
- bytes32 nameHash = hashName(name);
55
-
56
- Package storage package = _recordedPackages[nameHash];
57
-
58
- // Mark the package as existing if it isn't already tracked.
59
- if (!packageExists(nameHash)) {
60
-
61
- // Set package data
62
- package.exists = true;
63
- package.createdAt = block.timestamp; // solium-disable-line security/no-block-members
64
- package.name = name;
65
-
66
- // Add the nameHash to the list of all package nameHashes.
67
- _allPackageNameHashes.add(nameHash);
68
-
69
- emit PackageCreate(nameHash);
70
- }
71
-
72
- package.updatedAt = block.timestamp; // solium-disable-line security/no-block-members
73
-
74
- return true;
75
- }
76
-
77
- /// @dev Removes a package from the package db. Packages with existing releases may not be removed. Returns success.
78
- /// @param nameHash The name hash of a package.
79
- function removePackage(bytes32 nameHash, string reason)
80
- public
81
- auth
82
- onlyIfPackageExists(nameHash)
83
- returns (bool)
84
- {
85
- emit PackageDelete(nameHash, reason);
86
-
87
- delete _recordedPackages[nameHash];
88
- _allPackageNameHashes.remove(nameHash);
89
-
90
- return true;
91
- }
92
-
93
- /// @dev Sets the owner of a package to the provided address. Returns success.
94
- /// @param nameHash The name hash of a package.
95
- /// @param newPackageOwner The address of the new owner.
96
- function setPackageOwner(bytes32 nameHash, address newPackageOwner)
97
- public
98
- auth
99
- onlyIfPackageExists(nameHash)
100
- returns (bool)
101
- {
102
- emit PackageOwnerUpdate(nameHash, _recordedPackages[nameHash].owner, newPackageOwner);
103
-
104
- _recordedPackages[nameHash].owner = newPackageOwner;
105
- _recordedPackages[nameHash].updatedAt = block.timestamp; // solium-disable-line security/no-block-members
106
-
107
- return true;
108
- }
109
-
110
- //
111
- // +------------+
112
- // | Read API |
113
- // +------------+
114
- //
115
-
116
- /// @dev Query the existence of a package with the given name. Returns boolean indicating whether the package exists.
117
- /// @param nameHash The name hash of a package.
118
- function packageExists(bytes32 nameHash)
119
- public
120
- view
121
- returns (bool)
122
- {
123
- return _recordedPackages[nameHash].exists;
124
- }
125
-
126
- /// @dev Return the total number of packages
127
- function getNumPackages()
128
- public
129
- view
130
- returns (uint)
131
- {
132
- return _allPackageNameHashes.size();
133
- }
134
-
135
- /// @dev Returns package namehash at the provided index from the set of all known name hashes.
136
- /// @param idx The index of the package name hash to retrieve.
137
- function getPackageNameHash(uint idx)
138
- public
139
- view
140
- returns (bytes32)
141
- {
142
- return _allPackageNameHashes.get(idx);
143
- }
144
-
145
- /// @dev Returns information about the package.
146
- /// @param nameHash The name hash to look up.
147
- function getPackageData(bytes32 nameHash)
148
- public
149
- view
150
- onlyIfPackageExists(nameHash)
151
- returns (
152
- address packageOwner,
153
- uint createdAt,
154
- uint updatedAt
155
- )
156
- {
157
- Package storage package = _recordedPackages[nameHash];
158
- return (package.owner, package.createdAt, package.updatedAt);
159
- }
160
-
161
- /// @dev Returns the package name for the given namehash
162
- /// @param nameHash The name hash to look up.
163
- function getPackageName(bytes32 nameHash)
164
- public
165
- view
166
- onlyIfPackageExists(nameHash)
167
- returns (string)
168
- {
169
- return _recordedPackages[nameHash].name;
170
- }
171
-
172
- /// @dev Returns a slice of the array of all package hashes for the named package.
173
- /// @param offset The starting index for the slice.
174
- /// @param limit The length of the slice
175
- function getAllPackageIds(uint _offset, uint limit)
176
- public
177
- view
178
- returns (
179
- bytes32[] packageIds,
180
- uint offset
181
- )
182
- {
183
- bytes32[] memory hashes; // Array of package ids to return
184
- uint cursor = _offset; // Index counter to traverse DB array
185
- uint remaining; // Counter to collect `limit` packages
186
- uint totalPackages = getNumPackages(); // Total number of packages in registry
187
-
188
- // Is request within range?
189
- if (cursor < totalPackages){
190
-
191
- // Get total remaining records
192
- remaining = totalPackages - cursor;
193
-
194
- // Number of records to collect is lesser of `remaining` and `limit`
195
- if (remaining > limit ){
196
- remaining = limit;
197
- }
198
-
199
- // Allocate return array
200
- hashes = new bytes32[](remaining);
201
-
202
- // Collect records. (IndexedOrderedSet manages deletions.)
203
- while(remaining > 0){
204
- bytes32 hash = getPackageNameHash(cursor);
205
- hashes[remaining - 1] = hash;
206
- remaining--;
207
- cursor++;
208
- }
209
- }
210
- return (hashes, cursor);
211
- }
212
-
213
- /*
214
- * Hash Functions
215
- */
216
- /// @dev Returns name hash for a given package name.
217
- /// @param name Package name
218
- function hashName(string name)
219
- public
220
- pure
221
- returns (bytes32)
222
- {
223
- return keccak256(abi.encodePacked(name));
224
- }
225
- }