Skip to content

Commit 2fb9739

Browse files
committed
Run forge fmt against rebased main
1 parent c1d3fa4 commit 2fb9739

20 files changed

Lines changed: 78 additions & 143 deletions

‎src/interfaces/IB20.sol‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ interface IB20 {
516516
/// @notice Updates the token's `name`. Requires `METADATA_ROLE`.
517517
/// No length restrictions. Emits `NameUpdated` followed by
518518
/// the ERC-5267 `EIP712DomainChanged()` event (in that
519-
/// order).
519+
/// order).
520520
/// @dev Several customers (Coinbase Tokenized Equities, Coinbase
521521
/// Wrapped Assets) need the ability to update name and symbol
522522
/// post-deployment for re-branding or legal-restructuring

‎src/lib/B20FactoryLib.sol‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,7 @@ library B20FactoryLib {
146146
{
147147
return abi.encode(
148148
IB20Factory.B20CreateParams({
149-
version: B20_CREATE_PARAMS_VERSION,
150-
name: name,
151-
symbol: symbol,
152-
initialAdmin: initialAdmin
149+
version: B20_CREATE_PARAMS_VERSION, name: name, symbol: symbol, initialAdmin: initialAdmin
153150
})
154151
);
155152
}
@@ -399,11 +396,7 @@ library B20FactoryLib {
399396
/// @param holders The security role-holder bundle.
400397
///
401398
/// @return initCalls The ABI-encoded `grantRole` initCalls.
402-
function buildRoleGrants(B20SecurityRoleHolders memory holders)
403-
internal
404-
pure
405-
returns (bytes[] memory initCalls)
406-
{
399+
function buildRoleGrants(B20SecurityRoleHolders memory holders) internal pure returns (bytes[] memory initCalls) {
407400
bytes32[] memory roles = new bytes32[](8);
408401
roles[0] = B20Constants.MINT_ROLE;
409402
roles[1] = B20Constants.BURN_ROLE;

‎test/lib/B20FactoryLibTest.sol‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ import {BaseTest} from "test/lib/BaseTest.sol";
1717
/// Re-using those gives the test contracts a uniform vocabulary with
1818
/// the rest of the suite. No `setUp` extension is needed.
1919
contract B20FactoryLibTest is BaseTest {
20-
// No additional state; `BaseTest`'s actor labels and helpers are sufficient.
21-
}
20+
// No additional state; `BaseTest`'s actor labels and helpers are sufficient.
21+
22+
}

‎test/lib/PolicyRegistryTest.sol‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ contract PolicyRegistryTest is BaseTest {
5858
/// sentinels before consuming it; the prediction matches by
5959
/// clamping pre-init reads up to `BUILTIN_POLICY_COUNT`.
6060
function _predictNextPolicyId(IPolicyRegistry.PolicyType policyType) internal view returns (uint64) {
61-
uint56 counter =
62-
uint56(uint256(vm.load(address(policyRegistry), MockPolicyRegistryStorage.nextCounterSlot())));
61+
uint56 counter = uint56(uint256(vm.load(address(policyRegistry), MockPolicyRegistryStorage.nextCounterSlot())));
6362
if (counter < PolicyRegistryConstants.BUILTIN_POLICY_COUNT) {
6463
counter = PolicyRegistryConstants.BUILTIN_POLICY_COUNT;
6564
}

‎test/lib/mocks/MockB20Factory.sol‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,7 @@ contract MockB20Factory is IB20Factory {
313313
function _writeSecurityStorage(address token, string memory isin_, uint256 minimumRedeemable_) internal {
314314
_writeString(token, MockB20SecurityStorage.identifierSlot("ISIN"), isin_);
315315
_writeUint(token, MockB20RedeemStorage.minimumRedeemableSlot(), minimumRedeemable_);
316-
_writeUint(
317-
token,
318-
MockB20RedeemStorage.redeemPolicyIdsSlot(),
319-
uint256(PolicyRegistryConstants.ALWAYS_BLOCK_ID)
320-
);
316+
_writeUint(token, MockB20RedeemStorage.redeemPolicyIdsSlot(), uint256(PolicyRegistryConstants.ALWAYS_BLOCK_ID));
321317
}
322318

323319
// ============================================================

‎test/lib/mocks/MockB20Storage.sol‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,17 @@ library MockB20SecurityStorage {
407407
// TOP-LEVEL FIELD SLOTS
408408
// ============================================================
409409

410-
function sharesToTokensRatioSlot() internal pure returns (bytes32) { return slotOf(SHARES_TO_TOKENS_RATIO_OFFSET); }
411-
function usedAnnouncementIdsBaseSlot() internal pure returns (bytes32) { return slotOf(USED_ANNOUNCEMENT_IDS_OFFSET); }
412-
function identifiersBaseSlot() internal pure returns (bytes32) { return slotOf(IDENTIFIERS_OFFSET); }
410+
function sharesToTokensRatioSlot() internal pure returns (bytes32) {
411+
return slotOf(SHARES_TO_TOKENS_RATIO_OFFSET);
412+
}
413+
414+
function usedAnnouncementIdsBaseSlot() internal pure returns (bytes32) {
415+
return slotOf(USED_ANNOUNCEMENT_IDS_OFFSET);
416+
}
417+
418+
function identifiersBaseSlot() internal pure returns (bytes32) {
419+
return slotOf(IDENTIFIERS_OFFSET);
420+
}
413421

414422
// ============================================================
415423
// MAPPING MEMBER SLOTS
@@ -493,8 +501,13 @@ library MockB20RedeemStorage {
493501
// TOP-LEVEL FIELD SLOTS
494502
// ============================================================
495503

496-
function minimumRedeemableSlot() internal pure returns (bytes32) { return slotOf(MINIMUM_REDEEMABLE_OFFSET); }
497-
function redeemPolicyIdsSlot() internal pure returns (bytes32) { return slotOf(REDEEM_POLICY_IDS_OFFSET); }
504+
function minimumRedeemableSlot() internal pure returns (bytes32) {
505+
return slotOf(MINIMUM_REDEEMABLE_OFFSET);
506+
}
507+
508+
function redeemPolicyIdsSlot() internal pure returns (bytes32) {
509+
return slotOf(REDEEM_POLICY_IDS_OFFSET);
510+
}
498511
}
499512

500513
/// @title MockB20StablecoinStorage

‎test/unit/B20/roles/renounceLastAdmin.t.sol‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,14 @@ contract B20RenounceLastAdminTest is B20Test {
129129
/// here too.
130130
function test_renounceLastAdmin_success_adminCountDrivenToZero() public {
131131
bytes32 adminCountSlot = MockB20Storage.adminCountSlot();
132-
assertEq(
133-
uint256(vm.load(address(token), adminCountSlot)), 1, "precondition: adminCount is 1"
134-
);
132+
assertEq(uint256(vm.load(address(token), adminCountSlot)), 1, "precondition: adminCount is 1");
135133
_assertInitialized(address(token), "precondition: initialized marker is set");
136134

137135
vm.prank(admin);
138136
token.renounceLastAdmin();
139137

140-
assertEq(
141-
uint256(vm.load(address(token), adminCountSlot)), 0, "adminCount must be 0 post-renounce"
142-
);
143-
_assertInitialized(
144-
address(token),
145-
"initialized marker must remain set (renounce only clears adminCount)"
146-
);
138+
assertEq(uint256(vm.load(address(token), adminCountSlot)), 0, "adminCount must be 0 post-renounce");
139+
_assertInitialized(address(token), "initialized marker must remain set (renounce only clears adminCount)");
147140
}
148141

149142
/// @notice Verifies renounceLastAdmin emits LastAdminRenounced(previousAdmin)

‎test/unit/B20/roles/renounceRole.t.sol‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ contract B20RenounceRoleTest is B20Test {
112112
uint256(1),
113113
"roles[ADMIN][otherAdmin] slot must still be set"
114114
);
115-
assertEq(
116-
uint256(vm.load(address(token), MockB20Storage.adminCountSlot())), 1, "adminCount must drop to 1"
117-
);
115+
assertEq(uint256(vm.load(address(token), MockB20Storage.adminCountSlot())), 1, "adminCount must drop to 1");
118116
_assertInitialized(address(token), "initialized marker must stay set");
119117
}
120118

‎test/unit/B20Factory/createToken.t.sol‎

Lines changed: 22 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
6363
IB20Factory.B20CreateParams memory p = _b20Params();
6464
p.version = badVersion;
6565
vm.prank(caller);
66-
vm.expectRevert(abi.encodeWithSelector(IB20Factory.UnsupportedVersion.selector, badVersion, IB20Factory.B20Variant.DEFAULT));
66+
vm.expectRevert(
67+
abi.encodeWithSelector(IB20Factory.UnsupportedVersion.selector, badVersion, IB20Factory.B20Variant.DEFAULT)
68+
);
6769
factory.createB20(IB20Factory.B20Variant.DEFAULT, salt, abi.encode(p), new bytes[](0));
6870
}
6971

@@ -78,7 +80,11 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
7880
IB20Factory.B20StablecoinCreateParams memory p = _stablecoinParams();
7981
p.version = badVersion;
8082
vm.prank(caller);
81-
vm.expectRevert(abi.encodeWithSelector(IB20Factory.UnsupportedVersion.selector, badVersion, IB20Factory.B20Variant.STABLECOIN));
83+
vm.expectRevert(
84+
abi.encodeWithSelector(
85+
IB20Factory.UnsupportedVersion.selector, badVersion, IB20Factory.B20Variant.STABLECOIN
86+
)
87+
);
8288
factory.createB20(IB20Factory.B20Variant.STABLECOIN, salt, abi.encode(p), new bytes[](0));
8389
}
8490

@@ -108,15 +114,15 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
108114

109115
/// @notice Verifies createToken reverts for any unsupported version byte on the SECURITY variant
110116
/// @dev Each variant arm has its own version check; this exercises the security arm's check.
111-
function test_createB20_revert_unsupportedVersion_security(address caller, uint8 badVersion, bytes32 salt)
112-
public
113-
{
117+
function test_createB20_revert_unsupportedVersion_security(address caller, uint8 badVersion, bytes32 salt) public {
114118
_assumeValidCaller(caller);
115119
vm.assume(badVersion != 1);
116120
IB20Factory.B20SecurityCreateParams memory p = _securityParams();
117121
p.version = badVersion;
118122
vm.prank(caller);
119-
vm.expectRevert(abi.encodeWithSelector(IB20Factory.UnsupportedVersion.selector, badVersion, IB20Factory.B20Variant.SECURITY));
123+
vm.expectRevert(
124+
abi.encodeWithSelector(IB20Factory.UnsupportedVersion.selector, badVersion, IB20Factory.B20Variant.SECURITY)
125+
);
120126
factory.createB20(IB20Factory.B20Variant.SECURITY, salt, abi.encode(p), new bytes[](0));
121127
}
122128

@@ -251,9 +257,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
251257
/// `base.b20.security` namespace and `minimumRedeemable` at the
252258
/// `base.b20.redeem` namespace. Paired slot assertions confirm both fields
253259
/// land at the expected slots with the correct encodings.
254-
function test_createB20_success_securitySeedsInitialState(address caller, bytes32 salt, uint256 minRedeem)
255-
public
256-
{
260+
function test_createB20_success_securitySeedsInitialState(address caller, bytes32 salt, uint256 minRedeem) public {
257261
_assumeValidCaller(caller);
258262
IB20Factory.B20SecurityCreateParams memory p =
259263
_securityParams("Security Test", "SEC", admin, APPLE_ISIN, minRedeem);
@@ -297,11 +301,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
297301
PolicyRegistryConstants.ALWAYS_BLOCK_ID,
298302
"redeemPolicyIds slot lane 0 must hold ALWAYS_BLOCK_ID"
299303
);
300-
assertEq(
301-
packed >> 64,
302-
uint256(0),
303-
"redeemPolicyIds slot reserved lanes must be zero on a fresh token"
304-
);
304+
assertEq(packed >> 64, uint256(0), "redeemPolicyIds slot reserved lanes must be zero on a fresh token");
305305
}
306306

307307
/// @notice Verifies the security REDEEM_SENDER_POLICY default does NOT leak into other
@@ -310,9 +310,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
310310
/// namespace (`base.b20.redeem`); the base packed policy slots (`transferPolicyIds`,
311311
/// `mintPolicyIds` in the base `base.b20` namespace) must remain at their EVM zero
312312
/// defaults so the four base scopes still read as ALWAYS_ALLOW_ID.
313-
function test_createB20_success_securityOtherPolicySlotsDefaultToAllow(address caller, bytes32 salt)
314-
public
315-
{
313+
function test_createB20_success_securityOtherPolicySlotsDefaultToAllow(address caller, bytes32 salt) public {
316314
_assumeValidCaller(caller);
317315
address token = _createSecurity(caller, salt, _securityParams(), new bytes[](0));
318316

@@ -355,9 +353,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
355353
/// in `initCalls`. The privileged-window bypass on the token means the factory-originated
356354
/// call succeeds without the role check. Post-creation the slot reflects the overridden
357355
/// value, NOT the factory-seeded default.
358-
function test_createB20_success_securityRedeemPolicyOverridableViaInitCall(address caller, bytes32 salt)
359-
public
360-
{
356+
function test_createB20_success_securityRedeemPolicyOverridableViaInitCall(address caller, bytes32 salt) public {
361357
_assumeValidCaller(caller);
362358
bytes[] memory initCalls = new bytes[](1);
363359
initCalls[0] = abi.encodeWithSelector(
@@ -404,11 +400,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
404400
assertFalse(MockB20(token).hasRole(B20Constants.DEFAULT_ADMIN_ROLE, caller), "caller must not hold admin");
405401
assertEq(IB20Security(token).securityIdentifier(IDENTIFIER_ISIN), DEFAULT_ISIN, "ISIN must still be set");
406402

407-
assertEq(
408-
uint256(vm.load(token, MockB20Storage.adminCountSlot())),
409-
0,
410-
"adminCount must be 0 on zero-admin path"
411-
);
403+
assertEq(uint256(vm.load(token, MockB20Storage.adminCountSlot())), 0, "adminCount must be 0 on zero-admin path");
412404
_assertInitialized(token, "initialized must still be set on zero-admin path");
413405
}
414406

@@ -444,11 +436,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
444436
_stablecoinParams("Test", "TST", admin, xFiat[i]),
445437
new bytes[](0)
446438
);
447-
assertEq(
448-
IB20Stablecoin(token).currency(),
449-
xFiat[i],
450-
"multi-country X-prefix fiat code must round-trip"
451-
);
439+
assertEq(IB20Stablecoin(token).currency(), xFiat[i], "multi-country X-prefix fiat code must round-trip");
452440
}
453441
}
454442

@@ -471,8 +459,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
471459
/// way the default emitter test pins decimals=18.
472460
function test_createB20_success_emitsB20Created_security(address caller, bytes32 salt) public {
473461
_assumeValidCaller(caller);
474-
IB20Factory.B20SecurityCreateParams memory p =
475-
_securityParams("Security Test", "SEC", admin, DEFAULT_ISIN, 0);
462+
IB20Factory.B20SecurityCreateParams memory p = _securityParams("Security Test", "SEC", admin, DEFAULT_ISIN, 0);
476463
address predicted = factory.getB20Address(IB20Factory.B20Variant.SECURITY, caller, salt);
477464

478465
vm.expectEmit(true, true, false, true, address(factory));
@@ -517,9 +504,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
517504
"factory must NOT appear in roles[ADMIN] slot"
518505
);
519506
assertEq(
520-
uint256(vm.load(token, MockB20Storage.adminCountSlot())),
521-
1,
522-
"adminCount must be 1 after bootstrap grant"
507+
uint256(vm.load(token, MockB20Storage.adminCountSlot())), 1, "adminCount must be 1 after bootstrap grant"
523508
);
524509
_assertInitialized(token, "initialized marker must be set after bootstrap closes");
525510
}
@@ -590,11 +575,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
590575
// Paired slot assertion: packed adminCount lane is 0 (no
591576
// bootstrap grant happened) but the initialized bit is still
592577
// set (the factory closed the bootstrap window after returning).
593-
assertEq(
594-
uint256(vm.load(token, MockB20Storage.adminCountSlot())),
595-
0,
596-
"adminCount must be 0 on zero-admin path"
597-
);
578+
assertEq(uint256(vm.load(token, MockB20Storage.adminCountSlot())), 0, "adminCount must be 0 on zero-admin path");
598579
_assertInitialized(token, "initialized must still be set on zero-admin path");
599580
}
600581

@@ -613,11 +594,7 @@ contract B20FactoryCreateB20Test is B20FactoryTest {
613594
// The stablecoin still got its variant data: currency is set.
614595
assertEq(IB20Stablecoin(token).currency(), "USD", "stablecoin currency must still be set");
615596

616-
assertEq(
617-
uint256(vm.load(token, MockB20Storage.adminCountSlot())),
618-
0,
619-
"adminCount must be 0 on zero-admin path"
620-
);
597+
assertEq(uint256(vm.load(token, MockB20Storage.adminCountSlot())), 0, "adminCount must be 0 on zero-admin path");
621598
_assertInitialized(token, "initialized must still be set on zero-admin path");
622599
assertEq(
623600
vm.load(token, MockB20StablecoinStorage.currencySlot()),

‎test/unit/B20Factory/getTokenAddress.t.sol‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ contract B20FactoryGetTokenAddressTest is B20FactoryTest {
1111
/// is happy with the raw byte but Solidity reverts at function entry on an
1212
/// out-of-range enum input from a fuzzer.
1313
function _boundVariant(uint8 variantInt) internal pure returns (IB20Factory.B20Variant) {
14-
return
15-
IB20Factory.B20Variant(
16-
uint8(bound(uint256(variantInt), 0, uint256(type(IB20Factory.B20Variant).max)))
17-
);
14+
return IB20Factory.B20Variant(uint8(bound(uint256(variantInt), 0, uint256(type(IB20Factory.B20Variant).max))));
1815
}
1916

2017
/// @notice Verifies getTokenAddress is deterministic for the same inputs

0 commit comments

Comments
 (0)