Skip to content

Commit

Permalink
♻️ Make Pod mothership internal (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized authored Oct 2, 2024
1 parent 0411fd1 commit 68989f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/accounts/Pod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abstract contract Pod is Receiver {
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

/// @dev Returns the mothership contract.
function mothership() public view virtual returns (address result) {
function _mothership() internal view virtual returns (address result) {
/// @solidity memory-safe-assembly
assembly {
result := shr(96, sload(_MOTHERSHIP_SLOT))
Expand Down Expand Up @@ -78,7 +78,7 @@ abstract contract Pod is Receiver {
/// @dev Requires that the caller is the mothership.
/// This is called in the `onlyMothership` modifier.
function _checkMothership() internal view virtual {
if (msg.sender != mothership()) revert CallerNotMothership();
if (msg.sender != _mothership()) revert CallerNotMothership();
}

/// @dev Requires that the caller is the mothership.
Expand Down
4 changes: 4 additions & 0 deletions test/utils/mocks/MockPod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import {Brutalizer} from "../Brutalizer.sol";
/// @dev WARNING! This mock is strictly intended for testing purposes only.
/// Do NOT copy anything here into production code unless you really know what you are doing.
contract MockPod is Pod, Brutalizer {
function mothership() public view returns (address) {
return _mothership();
}

function initializeMothership(address initialMothership) public {
_initializeMothership(_brutalized(initialMothership));
}
Expand Down

0 comments on commit 68989f9

Please sign in to comment.