@bananapus/address-registry-v6 0.0.8 → 0.0.9
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.
package/STYLE_GUIDE.md
CHANGED
|
@@ -197,7 +197,7 @@ interface IJBExample is IJBBase {
|
|
|
197
197
|
| Public/external function | `camelCase` | `cashOutTokensOf` |
|
|
198
198
|
| Internal/private function | `_camelCase` | `_processFee` |
|
|
199
199
|
| Internal storage | `_camelCase` | `_accountingContextForTokenOf` |
|
|
200
|
-
| Function parameter | `camelCase` | `projectId`, `cashOutCount` |
|
|
200
|
+
| Function parameter | `camelCase` (no underscores) | `projectId`, `cashOutCount` |
|
|
201
201
|
|
|
202
202
|
## NatSpec
|
|
203
203
|
|
|
@@ -253,9 +253,12 @@ uint256 public constant MAX_RESERVED_PERCENT = 10_000;
|
|
|
253
253
|
|
|
254
254
|
## Function Calls
|
|
255
255
|
|
|
256
|
-
Use named
|
|
256
|
+
Use named arguments for all function calls with 2 or more arguments — in both `src/` and `script/`:
|
|
257
257
|
|
|
258
258
|
```solidity
|
|
259
|
+
// Good — named arguments
|
|
260
|
+
token.mint({account: beneficiary, amount: count});
|
|
261
|
+
_transferOwnership({newOwner: address(0), projectId: 0});
|
|
259
262
|
PERMISSIONS.hasPermission({
|
|
260
263
|
operator: sender,
|
|
261
264
|
account: account,
|
|
@@ -264,8 +267,18 @@ PERMISSIONS.hasPermission({
|
|
|
264
267
|
includeRoot: true,
|
|
265
268
|
includeWildcardProjectId: true
|
|
266
269
|
});
|
|
270
|
+
|
|
271
|
+
// Bad — positional arguments with 2+ args
|
|
272
|
+
token.mint(beneficiary, count);
|
|
273
|
+
_transferOwnership(address(0), 0);
|
|
267
274
|
```
|
|
268
275
|
|
|
276
|
+
Single-argument calls use positional style: `_burn(amount)`.
|
|
277
|
+
|
|
278
|
+
This also applies to constructor calls, struct literals, and inherited/library calls (e.g., OZ `_mint`, `_safeMint`, `safeTransfer`, `allowance`, `Clones.cloneDeterministic`).
|
|
279
|
+
|
|
280
|
+
Named argument keys must use **camelCase** — never underscores. If a function's parameter names use underscores, rename them to camelCase first.
|
|
281
|
+
|
|
269
282
|
## Multiline Signatures
|
|
270
283
|
|
|
271
284
|
```solidity
|
|
@@ -553,6 +566,7 @@ CI checks formatting via `forge fmt --check`.
|
|
|
553
566
|
|
|
554
567
|
CI runs `forge build --sizes` to catch contracts approaching the 24KB limit. When the repo's default `optimizer_runs` differs from what you want for size checking, use `FOUNDRY_PROFILE=ci_sizes forge build --sizes` with a `[profile.ci_sizes]` section in `foundry.toml`.
|
|
555
568
|
|
|
569
|
+
|
|
556
570
|
## Repo-Specific Deviations
|
|
557
571
|
|
|
558
572
|
None. This repo follows the standard configuration exactly.
|
package/package.json
CHANGED
package/script/Deploy.s.sol
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.26;
|
|
3
3
|
|
|
4
|
-
import "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
|
|
5
|
-
import {Script
|
|
4
|
+
import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
|
|
5
|
+
import {Script} from "forge-std/Script.sol";
|
|
6
6
|
|
|
7
|
-
import "src/JBAddressRegistry.sol";
|
|
7
|
+
import {JBAddressRegistry} from "src/JBAddressRegistry.sol";
|
|
8
8
|
|
|
9
9
|
contract Deploy is Script, Sphinx {
|
|
10
10
|
bytes32 constant ADDRESS_REGISTRY_SALT = "_JBAddressRegistryV6_";
|
|
@@ -18,7 +18,9 @@ contract Deploy is Script, Sphinx {
|
|
|
18
18
|
|
|
19
19
|
function run() public sphinx {
|
|
20
20
|
// Only deploy if this bytecode is not already deployed.
|
|
21
|
-
if (!_isDeployed(
|
|
21
|
+
if (!_isDeployed({
|
|
22
|
+
salt: ADDRESS_REGISTRY_SALT, creationCode: type(JBAddressRegistry).creationCode, arguments: ""
|
|
23
|
+
})) {
|
|
22
24
|
new JBAddressRegistry{salt: ADDRESS_REGISTRY_SALT}();
|
|
23
25
|
}
|
|
24
26
|
}
|
|
@@ -13,7 +13,9 @@ struct AddressRegistryDeployment {
|
|
|
13
13
|
|
|
14
14
|
library AddressRegistryDeploymentLib {
|
|
15
15
|
// Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.
|
|
16
|
+
// forge-lint: disable-next-line(screaming-snake-case-const)
|
|
16
17
|
address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code"))));
|
|
18
|
+
// forge-lint: disable-next-line(screaming-snake-case-const)
|
|
17
19
|
Vm internal constant vm = Vm(VM_ADDRESS);
|
|
18
20
|
|
|
19
21
|
function getDeployment(string memory path) internal returns (AddressRegistryDeployment memory deployment) {
|
|
@@ -27,7 +29,7 @@ library AddressRegistryDeploymentLib {
|
|
|
27
29
|
|
|
28
30
|
for (uint256 _i; _i < networks.length; _i++) {
|
|
29
31
|
if (networks[_i].chainId == chainId) {
|
|
30
|
-
return getDeployment(path, networks[_i].name);
|
|
32
|
+
return getDeployment({path: path, networkName: networks[_i].name});
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -36,14 +38,20 @@ library AddressRegistryDeploymentLib {
|
|
|
36
38
|
|
|
37
39
|
function getDeployment(
|
|
38
40
|
string memory path,
|
|
39
|
-
string memory
|
|
41
|
+
string memory networkName
|
|
40
42
|
)
|
|
41
43
|
internal
|
|
42
44
|
view
|
|
43
45
|
returns (AddressRegistryDeployment memory deployment)
|
|
44
46
|
{
|
|
45
|
-
deployment.registry =
|
|
46
|
-
|
|
47
|
+
deployment.registry = IJBAddressRegistry(
|
|
48
|
+
_getDeploymentAddress({
|
|
49
|
+
path: path,
|
|
50
|
+
projectName: "nana-address-registry",
|
|
51
|
+
networkName: networkName,
|
|
52
|
+
contractName: "JBAddressRegistry"
|
|
53
|
+
})
|
|
54
|
+
);
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
/// @notice Get the address of a contract that was deployed by the Deploy script.
|
|
@@ -53,8 +61,8 @@ library AddressRegistryDeploymentLib {
|
|
|
53
61
|
/// @return The address of the contract.
|
|
54
62
|
function _getDeploymentAddress(
|
|
55
63
|
string memory path,
|
|
56
|
-
string memory
|
|
57
|
-
string memory
|
|
64
|
+
string memory projectName,
|
|
65
|
+
string memory networkName,
|
|
58
66
|
string memory contractName
|
|
59
67
|
)
|
|
60
68
|
internal
|
|
@@ -62,7 +70,8 @@ library AddressRegistryDeploymentLib {
|
|
|
62
70
|
returns (address)
|
|
63
71
|
{
|
|
64
72
|
string memory deploymentJson =
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
// forge-lint: disable-next-line(unsafe-cheatcode)
|
|
74
|
+
vm.readFile(string.concat(path, projectName, "/", networkName, "/", contractName, ".json"));
|
|
75
|
+
return stdJson.readAddress({json: deploymentJson, key: ".address"});
|
|
67
76
|
}
|
|
68
77
|
}
|
|
@@ -104,6 +104,7 @@ contract JBAddressRegistry is IJBAddressRegistry {
|
|
|
104
104
|
// forge-lint: disable-next-line(unsafe-typecast)
|
|
105
105
|
data = abi.encodePacked(bytes1(0xde), bytes1(0x94), origin, bytes1(0x88), uint64(nonce));
|
|
106
106
|
}
|
|
107
|
+
// forge-lint: disable-next-line(asm-keccak256)
|
|
107
108
|
bytes32 hash = keccak256(data);
|
|
108
109
|
assembly {
|
|
109
110
|
mstore(0, hash)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.26;
|
|
3
3
|
|
|
4
|
-
import "forge-std/Test.sol";
|
|
5
|
-
import "../src/JBAddressRegistry.sol";
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
|
+
import {JBAddressRegistry} from "../src/JBAddressRegistry.sol";
|
|
6
6
|
|
|
7
7
|
contract JBAddressRegistryTest is Test {
|
|
8
8
|
event AddressRegistered(address indexed addr, address indexed deployer, address caller);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.26;
|
|
3
3
|
|
|
4
|
-
import "forge-std/Test.sol";
|
|
5
|
-
import "../src/JBAddressRegistry.sol";
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
|
+
import {JBAddressRegistry} from "../src/JBAddressRegistry.sol";
|
|
6
6
|
|
|
7
7
|
contract JBAddressRegistryTest_Fork is Test {
|
|
8
8
|
address owner = makeAddr("_owner");
|