From 4dae3fca8660a0e2259efb879c676be382d37861 Mon Sep 17 00:00:00 2001 From: gabrielstoica Date: Thu, 31 Oct 2024 15:08:23 +0200 Subject: [PATCH] chore: rename missed workspace namings --- src/libraries/Errors.sol | 2 +- src/modules/invoice-module/InvoiceModule.sol | 8 ++--- .../invoice-module/libraries/Errors.sol | 4 +-- test/Base.t.sol | 14 ++++---- test/integration/Integration.t.sol | 6 ++-- .../create-invoice/createInvoice.t.sol | 36 +++++++++---------- .../create-invoice/createInvoice.tree | 4 +-- test/integration/fuzz/createInvoice.t.sol | 2 +- test/integration/shared/createInvoice.t.sol | 4 +-- test/mocks/MockModule.sol | 8 ++--- ...orkspace.sol => MockNonCompliantSpace.sol} | 6 ++-- .../space/withdraw-erc20/withdrawERC20.t.sol | 4 +-- .../withdraw-native/withdrawNative.t.sol | 18 +++++----- .../create-account/createAccount.t.sol | 16 ++++----- .../create-account/createAccount.tree | 2 +- test/utils/Errors.sol | 6 ++-- test/utils/Events.sol | 6 ---- 17 files changed, 70 insertions(+), 76 deletions(-) rename test/mocks/{MockNonCompliantWorkspace.sol => MockNonCompliantSpace.sol} (90%) diff --git a/src/libraries/Errors.sol b/src/libraries/Errors.sol index af1ac03f..799ce8ba 100644 --- a/src/libraries/Errors.sol +++ b/src/libraries/Errors.sol @@ -16,7 +16,7 @@ library Errors { //////////////////////////////////////////////////////////////////////////*/ /// @notice Thrown when `msg.sender` is not the {Space} contract owner - error CallerNotWorkspaceOwner(); + error CallerNotSpaceOwner(); /// @notice Thrown when a native token (ETH) withdrawal fails error NativeWithdrawFailed(); diff --git a/src/modules/invoice-module/InvoiceModule.sol b/src/modules/invoice-module/InvoiceModule.sol index 60f5babb..174db916 100644 --- a/src/modules/invoice-module/InvoiceModule.sol +++ b/src/modules/invoice-module/InvoiceModule.sol @@ -60,15 +60,15 @@ contract InvoiceModule is IInvoiceModule, StreamManager, ERC721 { //////////////////////////////////////////////////////////////////////////*/ /// @dev Allow only calls from contracts implementing the {ISpace} interface - modifier onlyWorkspace() { + modifier onlySpace() { // Checks: the sender is a valid non-zero code size contract if (msg.sender.code.length == 0) { - revert Errors.WorkspaceZeroCodeSize(); + revert Errors.SpaceZeroCodeSize(); } // Checks: the sender implements the ERC-165 interface required by {ISpace} bytes4 interfaceId = type(ISpace).interfaceId; - if (!ISpace(msg.sender).supportsInterface(interfaceId)) revert Errors.WorkspaceUnsupportedInterface(); + if (!ISpace(msg.sender).supportsInterface(interfaceId)) revert Errors.SpaceUnsupportedInterface(); _; } @@ -86,7 +86,7 @@ contract InvoiceModule is IInvoiceModule, StreamManager, ERC721 { //////////////////////////////////////////////////////////////////////////*/ /// @inheritdoc IInvoiceModule - function createInvoice(Types.Invoice calldata invoice) external onlyWorkspace returns (uint256 invoiceId) { + function createInvoice(Types.Invoice calldata invoice) external onlySpace returns (uint256 invoiceId) { // Checks: the amount is non-zero if (invoice.payment.amount == 0) { revert Errors.ZeroPaymentAmount(); diff --git a/src/modules/invoice-module/libraries/Errors.sol b/src/modules/invoice-module/libraries/Errors.sol index bd2648b5..e9f0c88f 100644 --- a/src/modules/invoice-module/libraries/Errors.sol +++ b/src/modules/invoice-module/libraries/Errors.sol @@ -9,10 +9,10 @@ library Errors { //////////////////////////////////////////////////////////////////////////*/ /// @notice Thrown when the caller is an invalid zero code contract or EOA - error WorkspaceZeroCodeSize(); + error SpaceZeroCodeSize(); /// @notice Thrown when the caller is a contract that does not implement the {ISpace} interface - error WorkspaceUnsupportedInterface(); + error SpaceUnsupportedInterface(); /// @notice Thrown when the end time of an invoice is in the past error EndTimeInThePast(); diff --git a/test/Base.t.sol b/test/Base.t.sol index be33800a..88349347 100644 --- a/test/Base.t.sol +++ b/test/Base.t.sol @@ -5,7 +5,7 @@ import { Events } from "./utils/Events.sol"; import { Users } from "./utils/Types.sol"; import { Test } from "forge-std/Test.sol"; import { MockERC20NoReturn } from "./mocks/MockERC20NoReturn.sol"; -import { MockNonCompliantWorkspace } from "./mocks/MockNonCompliantWorkspace.sol"; +import { MockNonCompliantSpace } from "./mocks/MockNonCompliantSpace.sol"; import { MockModule } from "./mocks/MockModule.sol"; import { MockBadReceiver } from "./mocks/MockBadReceiver.sol"; import { Space } from "./../src/Space.sol"; @@ -34,7 +34,7 @@ abstract contract Base_Test is Test, Events { ModuleKeeper internal moduleKeeper; MockERC20NoReturn internal usdt; MockModule internal mockModule; - MockNonCompliantWorkspace internal mockNonCompliantWorkspace; + MockNonCompliantSpace internal mockNonCompliantSpace; MockBadReceiver internal mockBadReceiver; MockERC721Collection internal mockERC721; MockERC1155Collection internal mockERC1155; @@ -65,7 +65,7 @@ abstract contract Base_Test is Test, Events { containerImplementation = address(new Space(entrypoint, address(stationRegistry))); mockModule = new MockModule(); - mockNonCompliantWorkspace = new MockNonCompliantWorkspace({ _owner: users.admin }); + mockNonCompliantSpace = new MockNonCompliantSpace({ _owner: users.admin }); mockBadReceiver = new MockBadReceiver(); mockERC721 = new MockERC721Collection("MockERC721Collection", "MC"); mockERC1155 = new MockERC1155Collection("https://nft.com/0x1.json"); @@ -79,7 +79,7 @@ abstract contract Base_Test is Test, Events { vm.label({ account: address(moduleKeeper), newLabel: "ModuleKeeper" }); vm.label({ account: address(usdt), newLabel: "USDT" }); vm.label({ account: address(mockModule), newLabel: "MockModule" }); - vm.label({ account: address(mockNonCompliantWorkspace), newLabel: "MockNonCompliantWorkspace" }); + vm.label({ account: address(mockNonCompliantSpace), newLabel: "MockNonCompliantSpace" }); } /*////////////////////////////////////////////////////////////////////////// @@ -107,11 +107,11 @@ abstract contract Base_Test is Test, Events { } /// @dev Deploys a new {MockBadSpace} smart account based on the provided `owner`, `moduleKeeper` and `initialModules` input params - function deployBadWorkspace( + function deployBadSpace( address _owner, uint256 _spaceId, address[] memory _initialModules - ) internal returns (MockBadSpace _badWorkspace) { + ) internal returns (MockBadSpace _badSpace) { vm.startPrank({ msgSender: users.admin }); for (uint256 i; i < _initialModules.length; ++i) { allowlistModule(_initialModules[i]); @@ -122,7 +122,7 @@ abstract contract Base_Test is Test, Events { computeCreateAccountCalldata({ deployer: _owner, stationId: _spaceId, initialModules: _initialModules }); vm.prank({ msgSender: _owner }); - _badWorkspace = MockBadSpace(payable(stationRegistry.createAccount({ _admin: _owner, _data: data }))); + _badSpace = MockBadSpace(payable(stationRegistry.createAccount({ _admin: _owner, _data: data }))); vm.stopPrank(); } diff --git a/test/integration/Integration.t.sol b/test/integration/Integration.t.sol index 58ca575b..275252f8 100644 --- a/test/integration/Integration.t.sol +++ b/test/integration/Integration.t.sol @@ -21,7 +21,7 @@ abstract contract Integration_Test is Base_Test { SablierV2LockupLinear internal sablierV2LockupLinear; SablierV2LockupTranched internal sablierV2LockupTranched; MockStreamManager internal mockStreamManager; - MockBadSpace internal badWorkspace; + MockBadSpace internal badSpace; /*////////////////////////////////////////////////////////////////////////// SET-UP FUNCTION @@ -41,7 +41,7 @@ abstract contract Integration_Test is Base_Test { space = deploySpace({ _owner: users.eve, _spaceId: 0, _initialModules: modules }); // Deploy a "bad" {Space} with the `mockBadReceiver` as the owner - badWorkspace = deployBadWorkspace({ _owner: address(mockBadReceiver), _spaceId: 0, _initialModules: modules }); + badSpace = deployBadSpace({ _owner: address(mockBadReceiver), _spaceId: 0, _initialModules: modules }); // Deploy the mock {StreamManager} mockStreamManager = new MockStreamManager(sablierV2LockupLinear, sablierV2LockupTranched, users.admin); @@ -51,7 +51,7 @@ abstract contract Integration_Test is Base_Test { vm.label({ account: address(sablierV2LockupLinear), newLabel: "SablierV2LockupLinear" }); vm.label({ account: address(sablierV2LockupTranched), newLabel: "SablierV2LockupTranched" }); vm.label({ account: address(space), newLabel: "Eve's Space" }); - vm.label({ account: address(badWorkspace), newLabel: "Bad receiver's Space" }); + vm.label({ account: address(badSpace), newLabel: "Bad receiver's Space" }); } /*////////////////////////////////////////////////////////////////////////// diff --git a/test/integration/concrete/invoice-module/create-invoice/createInvoice.t.sol b/test/integration/concrete/invoice-module/create-invoice/createInvoice.t.sol index 650f24c3..6dd4c516 100644 --- a/test/integration/concrete/invoice-module/create-invoice/createInvoice.t.sol +++ b/test/integration/concrete/invoice-module/create-invoice/createInvoice.t.sol @@ -17,8 +17,8 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha // Make Bob the caller in this test suite which is an EOA vm.startPrank({ msgSender: users.bob }); - // Expect the call to revert with the {WorkspaceZeroCodeSize} error - vm.expectRevert(Errors.WorkspaceZeroCodeSize.selector); + // Expect the call to revert with the {SpaceZeroCodeSize} error + vm.expectRevert(Errors.SpaceZeroCodeSize.selector); // Create an one-off transfer invoice invoice = createInvoiceWithOneOffTransfer({ asset: address(usdt) }); @@ -27,7 +27,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha invoiceModule.createInvoice(invoice); } - function test_RevertWhen_NonCompliantWorkspace() external whenCallerContract { + function test_RevertWhen_NonCompliantSpace() external whenCallerContract { // Make Eve the caller in this test suite as she's the owner of the {Space} contract vm.startPrank({ msgSender: users.eve }); @@ -39,14 +39,14 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha "createInvoice((uint8,uint40,uint40,(uint8,uint8,uint40,address,uint128,uint256)))", invoice ); - // Expect the call to revert with the {WorkspaceUnsupportedInterface} error - vm.expectRevert(Errors.WorkspaceUnsupportedInterface.selector); + // Expect the call to revert with the {SpaceUnsupportedInterface} error + vm.expectRevert(Errors.SpaceUnsupportedInterface.selector); // Run the test - mockNonCompliantWorkspace.execute({ module: address(invoiceModule), value: 0, data: data }); + mockNonCompliantSpace.execute({ module: address(invoiceModule), value: 0, data: data }); } - function test_RevertWhen_ZeroPaymentAmount() external whenCallerContract whenCompliantWorkspace { + function test_RevertWhen_ZeroPaymentAmount() external whenCallerContract whenCompliantSpace { // Make Eve the caller in this test suite as she's the owner of the {Space} contract vm.startPrank({ msgSender: users.eve }); @@ -71,7 +71,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_RevertWhen_StartTimeGreaterThanEndTime() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount { // Make Eve the caller in this test suite as she's the owner of the {Space} contract @@ -99,7 +99,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_RevertWhen_EndTimeInThePast() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime { @@ -132,7 +132,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_CreateInvoice_PaymentMethodOneOffTransfer() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture @@ -187,7 +187,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_RevertWhen_PaymentMethodRecurringTransfer_PaymentIntervalTooShortForSelectedRecurrence() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture @@ -218,7 +218,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_CreateInvoice_RecurringTransfer() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture @@ -273,7 +273,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_RevertWhen_PaymentMethodTranchedStream_RecurrenceSetToOneOff() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture @@ -303,7 +303,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_RevertWhen_PaymentMethodTranchedStream_PaymentIntervalTooShortForSelectedRecurrence() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture @@ -334,7 +334,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_RevertWhen_PaymentMethodTranchedStream_PaymentAssetNativeToken() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture @@ -366,7 +366,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_CreateInvoice_Tranched() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture @@ -421,7 +421,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_RevertWhen_PaymentMethodLinearStream_PaymentAssetNativeToken() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture @@ -451,7 +451,7 @@ contract CreateInvoice_Integration_Concret_Test is CreateInvoice_Integration_Sha function test_CreateInvoice_LinearStream() external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture diff --git a/test/integration/concrete/invoice-module/create-invoice/createInvoice.tree b/test/integration/concrete/invoice-module/create-invoice/createInvoice.tree index 29206853..23a5184e 100644 --- a/test/integration/concrete/invoice-module/create-invoice/createInvoice.tree +++ b/test/integration/concrete/invoice-module/create-invoice/createInvoice.tree @@ -1,9 +1,9 @@ createInvoice.t.sol ├── when the caller IS NOT a contract -│ └── it should revert with the {WorkspaceZeroCodeSize} error +│ └── it should revert with the {SpaceZeroCodeSize} error └── when the caller IS a contract ├── when the caller contract DOES NOT implement the ERC-165 {ISpace} interface - │ └── it should revert with the {WorkspaceUnsupportedInterface} error + │ └── it should revert with the {SpaceUnsupportedInterface} error └── when the caller contract DOES implement the ERC-165 {ISpace} interface ├── when the payment amount IS zero │ └── it should revert with the {ZeroPaymentAmount} error diff --git a/test/integration/fuzz/createInvoice.t.sol b/test/integration/fuzz/createInvoice.t.sol index 77437fbb..d5692321 100644 --- a/test/integration/fuzz/createInvoice.t.sol +++ b/test/integration/fuzz/createInvoice.t.sol @@ -25,7 +25,7 @@ contract CreateInvoice_Integration_Fuzz_Test is CreateInvoice_Integration_Shared ) external whenCallerContract - whenCompliantWorkspace + whenCompliantSpace whenNonZeroPaymentAmount whenStartTimeLowerThanEndTime whenEndTimeInTheFuture diff --git a/test/integration/shared/createInvoice.t.sol b/test/integration/shared/createInvoice.t.sol index 2debb19e..db174680 100644 --- a/test/integration/shared/createInvoice.t.sol +++ b/test/integration/shared/createInvoice.t.sol @@ -47,7 +47,7 @@ abstract contract CreateInvoice_Integration_Shared_Test is Integration_Test { _; } - modifier whenCompliantWorkspace() { + modifier whenCompliantSpace() { _; } @@ -189,7 +189,7 @@ abstract contract CreateInvoice_Integration_Shared_Test is Integration_Test { if (user == users.eve) { Space(space).execute({ module: address(invoiceModule), value: 0, data: data }); } else { - MockBadSpace(badWorkspace).execute({ module: address(invoiceModule), value: 0, data: data }); + MockBadSpace(badSpace).execute({ module: address(invoiceModule), value: 0, data: data }); } // Stop the active prank diff --git a/test/mocks/MockModule.sol b/test/mocks/MockModule.sol index bb4a78d1..78e22cf2 100644 --- a/test/mocks/MockModule.sol +++ b/test/mocks/MockModule.sol @@ -15,19 +15,19 @@ contract MockModule { event ModuleItemCreated(uint256 indexed id); /// @dev Allow only calls from contracts implementing the {ISpace} interface - modifier onlyWorkspace() { + modifier onlySpace() { // Checks: the sender is a valid non-zero code size contract if (msg.sender.code.length == 0) { - revert Errors.WorkspaceZeroCodeSize(); + revert Errors.SpaceZeroCodeSize(); } // Checks: the sender implements the ERC-165 interface required by {ISpace} bytes4 interfaceId = type(ISpace).interfaceId; - if (!IERC165(msg.sender).supportsInterface(interfaceId)) revert Errors.WorkspaceUnsupportedInterface(); + if (!IERC165(msg.sender).supportsInterface(interfaceId)) revert Errors.SpaceUnsupportedInterface(); _; } - function createModuleItem() external onlyWorkspace returns (uint256 id) { + function createModuleItem() external onlySpace returns (uint256 id) { // Get the next module item ID id = _nextItemIf; diff --git a/test/mocks/MockNonCompliantWorkspace.sol b/test/mocks/MockNonCompliantSpace.sol similarity index 90% rename from test/mocks/MockNonCompliantWorkspace.sol rename to test/mocks/MockNonCompliantSpace.sol index 8e02f6a0..e56cc6d9 100644 --- a/test/mocks/MockNonCompliantWorkspace.sol +++ b/test/mocks/MockNonCompliantSpace.sol @@ -4,9 +4,9 @@ pragma solidity ^0.8.26; import { ExcessivelySafeCall } from "@nomad-xyz/excessively-safe-call/src/ExcessivelySafeCall.sol"; import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; -/// @title Space -/// @notice A mock non-compliant space contract that do not support the {ISpace} interface -contract MockNonCompliantWorkspace is IERC165 { +/// @title MockNonCompliantSpace +/// @notice A mock non-compliant {Space} contract that do not support the {ISpace} interface +contract MockNonCompliantSpace is IERC165 { using ExcessivelySafeCall for address; address public owner; diff --git a/test/unit/concrete/space/withdraw-erc20/withdrawERC20.t.sol b/test/unit/concrete/space/withdraw-erc20/withdrawERC20.t.sol index 3234cc61..e94a2df3 100644 --- a/test/unit/concrete/space/withdraw-erc20/withdrawERC20.t.sol +++ b/test/unit/concrete/space/withdraw-erc20/withdrawERC20.t.sol @@ -57,8 +57,8 @@ contract WithdrawERC20_Unit_Concrete_Test is Space_Unit_Concrete_Test { space.withdrawERC20({ asset: IERC20(address(usdt)), amount: 10e6 }); // Assert the USDT balance of the {Space} contract - uint256 actualBalanceOfWorkspace = usdt.balanceOf(address(space)); - assertEq(actualBalanceOfWorkspace, 90e6); + uint256 actualBalanceOfSpace = usdt.balanceOf(address(space)); + assertEq(actualBalanceOfSpace, 90e6); // Assert the USDT balance of Eve uint256 actualBalanceOfEve = usdt.balanceOf(users.eve); diff --git a/test/unit/concrete/space/withdraw-native/withdrawNative.t.sol b/test/unit/concrete/space/withdraw-native/withdrawNative.t.sol index b5d24885..d92f006c 100644 --- a/test/unit/concrete/space/withdraw-native/withdrawNative.t.sol +++ b/test/unit/concrete/space/withdraw-native/withdrawNative.t.sol @@ -9,19 +9,19 @@ import { Events } from "../../../../utils/Events.sol"; contract WithdrawNative_Unit_Concrete_Test is Space_Unit_Concrete_Test { address badReceiver; - Space badWorkspace; + Space badSpace; function setUp() public virtual override { Space_Unit_Concrete_Test.setUp(); - // Create a bad receiver contract as the owner of the `badWorkspace` to test for the `NativeWithdrawFailed` error + // Create a bad receiver contract as the owner of the `badSpace` to test for the `NativeWithdrawFailed` error badReceiver = address(new MockBadReceiver()); vm.deal({ account: badReceiver, newBalance: 100 ether }); - // Deploy the `badWorkspace` space + // Deploy the `badSpace` space address[] memory modules = new address[](1); modules[0] = address(mockModule); - badWorkspace = deploySpace({ _owner: address(badReceiver), _spaceId: 0, _initialModules: modules }); + badSpace = deploySpace({ _owner: address(badReceiver), _spaceId: 0, _initialModules: modules }); } function test_RevertWhen_CallerNotOwner() external { @@ -59,13 +59,13 @@ contract WithdrawNative_Unit_Concrete_Test is Space_Unit_Concrete_Test { function test_RevertWhen_NativeWithdrawFailed() external whenCallerOwner(badReceiver) - whenSufficientNativeToWithdraw(badWorkspace) + whenSufficientNativeToWithdraw(badSpace) { // Expect the next call to revert with the {NativeWithdrawFailed} error vm.expectRevert(Errors.NativeWithdrawFailed.selector); // Run the test - badWorkspace.withdrawNative({ amount: 1 ether }); + badSpace.withdrawNative({ amount: 1 ether }); } modifier whenNativeWithdrawSucceeds() { @@ -79,7 +79,7 @@ contract WithdrawNative_Unit_Concrete_Test is Space_Unit_Concrete_Test { whenNativeWithdrawSucceeds { // Store the ETH balance of Eve and {Space} contract before withdrawal - uint256 balanceOfWorkspaceBefore = address(space).balance; + uint256 balanceOfSpaceBefore = address(space).balance; uint256 balanceOfEveBefore = address(users.eve).balance; uint256 ethToWithdraw = 1 ether; @@ -91,8 +91,8 @@ contract WithdrawNative_Unit_Concrete_Test is Space_Unit_Concrete_Test { space.withdrawNative({ amount: ethToWithdraw }); // Assert the ETH balance of the {Space} contract - uint256 actualBalanceOfWorkspace = address(space).balance; - assertEq(actualBalanceOfWorkspace, balanceOfWorkspaceBefore - ethToWithdraw); + uint256 actualBalanceOfSpace = address(space).balance; + assertEq(actualBalanceOfSpace, balanceOfSpaceBefore - ethToWithdraw); // Assert the ETH balance of Eve uint256 actualBalanceOfEve = address(users.eve).balance; diff --git a/test/unit/concrete/station-registry/create-account/createAccount.t.sol b/test/unit/concrete/station-registry/create-account/createAccount.t.sol index f75f66b0..e3a0dc9f 100644 --- a/test/unit/concrete/station-registry/create-account/createAccount.t.sol +++ b/test/unit/concrete/station-registry/create-account/createAccount.t.sol @@ -19,7 +19,7 @@ contract CreateAccount_Unit_Concrete_Test is StationRegistry_Unit_Concrete_Test // The {StationRegistry} contract deploys each new {Space} contract. // Therefore, we need to calculate the current nonce of the {StationRegistry} // to pre-compute the address of the new {Space} before deployment. - (address expectedWorkspace, bytes memory data) = + (address expectedSpace, bytes memory data) = computeDeploymentAddressAndCalldata({ deployer: users.bob, stationId: 0, initialModules: mockModules }); // Allowlist the mock modules on the {ModuleKeeper} contract from the admin account @@ -34,7 +34,7 @@ contract CreateAccount_Unit_Concrete_Test is StationRegistry_Unit_Concrete_Test emit Events.SpaceCreated({ owner: users.bob, stationId: 1, - space: Space(payable(expectedWorkspace)), + space: Space(payable(expectedSpace)), initialModules: mockModules }); @@ -49,7 +49,7 @@ contract CreateAccount_Unit_Concrete_Test is StationRegistry_Unit_Concrete_Test assertEq(users.bob, actualOwnerOfStation); // Assert the expected and actual station ID of the {Space} - uint256 actualStationIdOfSpace = stationRegistry.stationIdOfSpace({ space: expectedWorkspace }); + uint256 actualStationIdOfSpace = stationRegistry.stationIdOfSpace({ space: expectedSpace }); assertEq(1, actualStationIdOfSpace); } @@ -82,7 +82,7 @@ contract CreateAccount_Unit_Concrete_Test is StationRegistry_Unit_Concrete_Test // The {StationRegistry} contract deploys each new {Space} contract. // Therefore, we need to calculate the current nonce of the {StationRegistry} // to pre-compute the address of the new {Space} before deployment. - (address expectedWorkspace, bytes memory data) = + (address expectedSpace, bytes memory data) = computeDeploymentAddressAndCalldata({ deployer: users.bob, stationId: 1, initialModules: mockModules }); // Allowlist the mock modules on the {ModuleKeeper} contract from the admin account @@ -97,7 +97,7 @@ contract CreateAccount_Unit_Concrete_Test is StationRegistry_Unit_Concrete_Test emit Events.SpaceCreated({ owner: users.bob, stationId: 1, - space: Space(payable(expectedWorkspace)), + space: Space(payable(expectedSpace)), initialModules: mockModules }); @@ -108,11 +108,11 @@ contract CreateAccount_Unit_Concrete_Test is StationRegistry_Unit_Concrete_Test stationRegistry.createAccount({ _admin: users.bob, _data: data }); // Assert if the freshly deployed smart account is registered on the factory - bool isRegisteredOnFactory = stationRegistry.isRegistered(expectedWorkspace); + bool isRegisteredOnFactory = stationRegistry.isRegistered(expectedSpace); assertTrue(isRegisteredOnFactory); // Assert if the initial modules has been enabled on the {Space} smart account instance - bool isModuleEnabled = Space(payable(expectedWorkspace)).isModuleEnabled(mockModules[0]); + bool isModuleEnabled = Space(payable(expectedSpace)).isModuleEnabled(mockModules[0]); assertTrue(isModuleEnabled); // Assert the expected and actual owner of the station @@ -120,7 +120,7 @@ contract CreateAccount_Unit_Concrete_Test is StationRegistry_Unit_Concrete_Test assertEq(users.bob, actualOwnerOfStation); // Assert the expected and actual station ID of the {Space} - uint256 actualStationIdOfSpace = stationRegistry.stationIdOfSpace({ space: expectedWorkspace }); + uint256 actualStationIdOfSpace = stationRegistry.stationIdOfSpace({ space: expectedSpace }); assertEq(1, actualStationIdOfSpace); } } diff --git a/test/unit/concrete/station-registry/create-account/createAccount.tree b/test/unit/concrete/station-registry/create-account/createAccount.tree index 50595621..482355a5 100644 --- a/test/unit/concrete/station-registry/create-account/createAccount.tree +++ b/test/unit/concrete/station-registry/create-account/createAccount.tree @@ -1,4 +1,4 @@ -createWorkspace.t.sol +createSpace.t.sol ├── when station ID is zero │ └── it should create a new station with the caller address as the owner └── when station ID is non-zero diff --git a/test/utils/Errors.sol b/test/utils/Errors.sol index 998b0f7c..3d9865f2 100644 --- a/test/utils/Errors.sol +++ b/test/utils/Errors.sol @@ -14,7 +14,7 @@ library Errors { //////////////////////////////////////////////////////////////////////////*/ /// @notice Thrown when `msg.sender` is not the {Space} contract owner - error CallerNotWorkspaceOwner(); + error CallerNotSpaceOwner(); /// @notice Thrown when a native token (ETH) withdrawal fails error NativeWithdrawFailed(); @@ -64,10 +64,10 @@ library Errors { //////////////////////////////////////////////////////////////////////////*/ /// @notice Thrown when the caller is an invalid zero code contract or EOA - error WorkspaceZeroCodeSize(); + error SpaceZeroCodeSize(); /// @notice Thrown when the caller is a contract that does not implement the {ISpace} interface - error WorkspaceUnsupportedInterface(); + error SpaceUnsupportedInterface(); /// @notice Thrown when the end time of an invoice is in the past error EndTimeInThePast(); diff --git a/test/utils/Events.sol b/test/utils/Events.sol index cb3bbdbb..46263377 100644 --- a/test/utils/Events.sol +++ b/test/utils/Events.sol @@ -19,12 +19,6 @@ abstract contract Events { /// @param initialModules Array of initially enabled modules event SpaceCreated(address indexed owner, uint256 indexed stationId, Space space, address[] initialModules); - /// @notice Emitted when the ownership of a {Space} is transferred to a new owner - /// @param space The address of the {Space} - /// @param oldOwner The address of the current owner - /// @param newOwner The address of the new owner - event WorkspaceOwnershipTransferred(Space indexed space, address oldOwner, address newOwner); - /// @notice Emitted when the ownership of a {Station} is transferred to a new owner /// @param stationId The address of the {Station} /// @param oldOwner The address of the current owner