@@ -6,12 +6,12 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeab
66import {IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol " ;
77
88/**
9- * @title ConfidentialTokensRegistry
9+ * @title ConfidentialTokenWrappersRegistry
1010 * @notice A registry contract to map ERC20 token addresses to their corresponding ERC7984
1111 * confidential fhevm wrapper addresses, also called confidential tokens.
1212 * @dev This contract allows an owner to register new entries and flag revoked ones.
1313 */
14- contract ConfidentialTokensRegistry is Ownable2StepUpgradeable , UUPSUpgradeable {
14+ contract ConfidentialTokenWrappersRegistry is Ownable2StepUpgradeable , UUPSUpgradeable {
1515 /// @notice Struct to represent a (token, confidential token, is revoked) tuple.
1616 struct ConfidentialTokenPair {
1717 /// @notice The address of the token.
@@ -22,8 +22,8 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
2222 bool isRevoked;
2323 }
2424
25- /// @custom:storage-location erc7201:fhevm_protocol.storage.ConfidentialTokensRegistry
26- struct ConfidentialTokensRegistryStorage {
25+ /// @custom:storage-location erc7201:fhevm_protocol.storage.ConfidentialTokenWrappersRegistry
26+ struct ConfidentialTokenWrappersRegistryStorage {
2727 /// @notice Mapping from token address to confidential token address.
2828 mapping (address tokenAddress = > address confidentialTokenAddress ) _tokensToConfidentialTokens;
2929 /// @notice Mapping from confidential token address to token address.
@@ -36,9 +36,9 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
3636 ConfidentialTokenPair[] _tokenConfidentialTokenPairs;
3737 }
3838
39- // keccak256(abi.encode(uint256(keccak256("fhevm_protocol.storage.ConfidentialTokensRegistry ")) - 1)) & ~bytes32(uint256(0xff))
40- bytes32 private constant CONFIDENTIAL_TOKENS_REGISTRY_STORAGE_LOCATION =
41- 0x25094496394205337c7da64eaca0c35bf780125467d04de96cd0ee9b701d6c00 ;
39+ // keccak256(abi.encode(uint256(keccak256("fhevm_protocol.storage.ConfidentialTokenWrappersRegistry ")) - 1)) & ~bytes32(uint256(0xff))
40+ bytes32 private constant CONFIDENTIAL_TOKEN_WRAPPERS_REGISTRY_STORAGE_LOCATION =
41+ 0xc361bd0b1d7584416623b46edb98317525b8de8e557ab49cee21f14d6752da00 ;
4242
4343 /// @notice Error thrown when the token address is zero.
4444 error TokenZeroAddress ();
@@ -80,7 +80,7 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
8080 }
8181
8282 /**
83- * @notice Initialize the ConfidentialTokensRegistry contract.
83+ * @notice Initialize the ConfidentialTokenWrappersRegistry contract.
8484 * @param initialOwner The initial owner of the contract.
8585 */
8686 function initialize (address initialOwner ) public initializer {
@@ -116,7 +116,7 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
116116 revert TokenAlreadyAssociatedWithConfidentialToken (tokenAddress, existingConfidentialTokenAddress);
117117 }
118118
119- ConfidentialTokensRegistryStorage storage $ = _getConfidentialTokensRegistryStorage ();
119+ ConfidentialTokenWrappersRegistryStorage storage $ = _getConfidentialTokenWrappersRegistryStorage ();
120120
121121 // Register the token and confidential token mappings.
122122 $._tokensToConfidentialTokens[tokenAddress] = confidentialTokenAddress;
@@ -155,7 +155,7 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
155155 revert NoTokenAssociatedWithConfidentialToken (confidentialTokenAddress);
156156 }
157157
158- ConfidentialTokensRegistryStorage storage $ = _getConfidentialTokensRegistryStorage ();
158+ ConfidentialTokenWrappersRegistryStorage storage $ = _getConfidentialTokenWrappersRegistryStorage ();
159159
160160 $._revokedConfidentialTokens[confidentialTokenAddress] = true ;
161161
@@ -173,7 +173,7 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
173173 * @return The address of the confidential token.
174174 */
175175 function getConfidentialTokenAddress (address tokenAddress ) public view returns (bool , address ) {
176- address confidentialTokenAddress = _getConfidentialTokensRegistryStorage ()._tokensToConfidentialTokens[
176+ address confidentialTokenAddress = _getConfidentialTokenWrappersRegistryStorage ()._tokensToConfidentialTokens[
177177 tokenAddress
178178 ];
179179 bool isRevoked = isConfidentialTokenRevoked (confidentialTokenAddress);
@@ -189,7 +189,7 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
189189 */
190190 function getTokenAddress (address confidentialTokenAddress ) public view returns (bool , address ) {
191191 bool isRevoked = isConfidentialTokenRevoked (confidentialTokenAddress);
192- address tokenAddress = _getConfidentialTokensRegistryStorage ()._confidentialTokensToTokens[
192+ address tokenAddress = _getConfidentialTokenWrappersRegistryStorage ()._confidentialTokensToTokens[
193193 confidentialTokenAddress
194194 ];
195195 return (isRevoked, tokenAddress);
@@ -202,7 +202,7 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
202202 * @return The array of (token address, confidential token address, is revoked) tuples.
203203 */
204204 function getTokenConfidentialTokenPairs () public view returns (ConfidentialTokenPair[] memory ) {
205- return _getConfidentialTokensRegistryStorage ()._tokenConfidentialTokenPairs;
205+ return _getConfidentialTokenWrappersRegistryStorage ()._tokenConfidentialTokenPairs;
206206 }
207207
208208 /**
@@ -211,7 +211,7 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
211211 * @return True if the confidential token has been revoked, false otherwise.
212212 */
213213 function isConfidentialTokenRevoked (address confidentialTokenAddress ) public view returns (bool ) {
214- return _getConfidentialTokensRegistryStorage ()._revokedConfidentialTokens[confidentialTokenAddress];
214+ return _getConfidentialTokenWrappersRegistryStorage ()._revokedConfidentialTokens[confidentialTokenAddress];
215215 }
216216
217217 function _authorizeUpgrade (address newImplementation ) internal override onlyOwner {}
@@ -239,13 +239,13 @@ contract ConfidentialTokensRegistry is Ownable2StepUpgradeable, UUPSUpgradeable
239239 }
240240 }
241241
242- function _getConfidentialTokensRegistryStorage ()
242+ function _getConfidentialTokenWrappersRegistryStorage ()
243243 private
244244 pure
245- returns (ConfidentialTokensRegistryStorage storage $)
245+ returns (ConfidentialTokenWrappersRegistryStorage storage $)
246246 {
247247 assembly {
248- $.slot := CONFIDENTIAL_TOKENS_REGISTRY_STORAGE_LOCATION
248+ $.slot := CONFIDENTIAL_TOKEN_WRAPPERS_REGISTRY_STORAGE_LOCATION
249249 }
250250 }
251251}
0 commit comments