@@ -5,7 +5,7 @@ pragma solidity ^0.8.25;
55import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol " ;
66import {IOwnerFreezableV1, IERC5313 } from "../interface/IOwnerFreezableV1.sol " ;
77
8- /// @dev String ID for the OwnerFreezableV1 storage location.
8+ /// @dev String ID for the OwnerFreezableV1 storage location v1 .
99string constant OWNER_FREEZABLE_V1_STORAGE_ID = "rain.storage.owner-freezable.1 " ;
1010
1111/// @dev "rain.storage.owner-freezable.1" with the erc7201 formula.
@@ -65,8 +65,9 @@ abstract contract OwnerFreezable is IOwnerFreezableV1, OwnableUpgradeable {
6565 mapping (address to = > uint256 protectedUntil ) alwaysAllowedTos;
6666 }
6767
68- function getStorage () private pure returns (OwnerFreezableV17201Storage storage s ) {
69- assembly {
68+ /// @dev Accessor for the owner freezable storage.
69+ function getStorageOwnerFreezable () private pure returns (OwnerFreezableV17201Storage storage s ) {
70+ assembly ("memory-safe" ) {
7071 s.slot := OWNER_FREEZABLE_V1_STORAGE_LOCATION
7172 }
7273 }
@@ -78,25 +79,25 @@ abstract contract OwnerFreezable is IOwnerFreezableV1, OwnableUpgradeable {
7879
7980 /// @inheritdoc IOwnerFreezableV1
8081 function ownerFrozenUntil () external view returns (uint256 ) {
81- OwnerFreezableV17201Storage storage s = getStorage ();
82+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
8283 return s.ownerFrozenUntil;
8384 }
8485
8586 /// @inheritdoc IOwnerFreezableV1
8687 function ownerFreezeAlwaysAllowedFrom (address from ) external view returns (uint256 ) {
87- OwnerFreezableV17201Storage storage s = getStorage ();
88+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
8889 return s.alwaysAllowedFroms[from];
8990 }
9091
9192 /// @inheritdoc IOwnerFreezableV1
9293 function ownerFreezeAlwaysAllowedTo (address to ) external view returns (uint256 ) {
93- OwnerFreezableV17201Storage storage s = getStorage ();
94+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
9495 return s.alwaysAllowedTos[to];
9596 }
9697
9798 /// @inheritdoc IOwnerFreezableV1
9899 function ownerFreezeUntil (uint256 freezeUntil ) external onlyOwner {
99- OwnerFreezableV17201Storage storage s = getStorage ();
100+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
100101 // Freezing is additive so we can only increase the freeze time.
101102 // It is a no-op on the state if the new freeze time is less than the
102103 // current one.
@@ -118,7 +119,7 @@ abstract contract OwnerFreezable is IOwnerFreezableV1, OwnableUpgradeable {
118119 revert OwnerFreezeAlwaysAllowedFromZero (from);
119120 }
120121
121- OwnerFreezableV17201Storage storage s = getStorage ();
122+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
122123
123124 // Adding a `from` is additive so we can only increase the protected
124125 // time. It is a no-op on the state if the new protected time is less
@@ -134,7 +135,7 @@ abstract contract OwnerFreezable is IOwnerFreezableV1, OwnableUpgradeable {
134135
135136 /// @inheritdoc IOwnerFreezableV1
136137 function ownerFreezeStopAlwaysAllowingFrom (address from ) external onlyOwner {
137- OwnerFreezableV17201Storage storage s = getStorage ();
138+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
138139
139140 // If the current time is after the protection for this `from` then
140141 // we can remove it. Otherwise we revert to respect the protection.
@@ -154,7 +155,7 @@ abstract contract OwnerFreezable is IOwnerFreezableV1, OwnableUpgradeable {
154155 revert IOwnerFreezableV1.OwnerFreezeAlwaysAllowedToZero (to);
155156 }
156157
157- OwnerFreezableV17201Storage storage s = getStorage ();
158+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
158159
159160 // Adding a `to` is additive so we can only increase the protected time.
160161 // It is a no-op on the state if the new protected time is less than the
@@ -170,7 +171,7 @@ abstract contract OwnerFreezable is IOwnerFreezableV1, OwnableUpgradeable {
170171
171172 /// @inheritdoc IOwnerFreezableV1
172173 function ownerFreezeStopAlwaysAllowingTo (address to ) external onlyOwner {
173- OwnerFreezableV17201Storage storage s = getStorage ();
174+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
174175
175176 // If the current time is after the protection for this `to` then
176177 // we can remove it. Otherwise we revert to respect the protection.
@@ -187,7 +188,7 @@ abstract contract OwnerFreezable is IOwnerFreezableV1, OwnableUpgradeable {
187188 /// @param from The address that tokens are being sent from.
188189 /// @param to The address that tokens are being sent to.
189190 function ownerFreezeCheckTransaction (address from , address to ) internal view {
190- OwnerFreezableV17201Storage storage s = getStorage ();
191+ OwnerFreezableV17201Storage storage s = getStorageOwnerFreezable ();
191192
192193 // We either simply revert or no-op for this check.
193194 // Revert if the contract is frozen and neither the `from` nor `to` are
0 commit comments