Skip to content

Expose StorageLocation constant as internal #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/transform-namespaces.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Generated by [AVA](https://avajs.dev).
}␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C2")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C2StorageLocation = 0xf05a05e0e3d15983ea921cad031aaea3040e9d631039045748753d29c5d24800;␊
bytes32 internal constant C2StorageLocation = 0xf05a05e0e3d15983ea921cad031aaea3040e9d631039045748753d29c5d24800;␊
function _getC2Storage() private pure returns (C2Storage storage $) {␊
assembly {␊
Expand Down Expand Up @@ -76,7 +76,7 @@ Generated by [AVA](https://avajs.dev).
}␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C3")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C3StorageLocation = 0xaa7e0685867d809c517036b8f21e99d58bd04b1da2b202f167c355fdf82b4a00;␊
bytes32 internal constant C3StorageLocation = 0xaa7e0685867d809c517036b8f21e99d58bd04b1da2b202f167c355fdf82b4a00;␊
function _getC3Storage() private pure returns (C3Storage storage $) {␊
assembly {␊
Expand All @@ -92,7 +92,7 @@ Generated by [AVA](https://avajs.dev).
}␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C4")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C4StorageLocation = 0x536a56e760d844b098efcc16711808e0b18bad9e07c2e82c78312ab719318d00;␊
bytes32 internal constant C4StorageLocation = 0x536a56e760d844b098efcc16711808e0b18bad9e07c2e82c78312ab719318d00;␊
function _getC4Storage() private pure returns (C4Storage storage $) {␊
assembly {␊
Expand Down Expand Up @@ -124,7 +124,7 @@ Generated by [AVA](https://avajs.dev).
}␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C5")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C5StorageLocation = 0xd94dd1cf5c0ce3bfbbd2555b11ad43bf11eeff03081ca744441b0fb7c0a6ec00;␊
bytes32 internal constant C5StorageLocation = 0xd94dd1cf5c0ce3bfbbd2555b11ad43bf11eeff03081ca744441b0fb7c0a6ec00;␊
function _getC5Storage() private pure returns (C5Storage storage $) {␊
assembly {␊
Expand Down Expand Up @@ -155,7 +155,7 @@ Generated by [AVA](https://avajs.dev).
}␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C7")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C7StorageLocation = 0x931371859ca5c5440d3850c7cf9c14adb9d1257b7ddd15562d561cd48871d300;␊
bytes32 internal constant C7StorageLocation = 0x931371859ca5c5440d3850c7cf9c14adb9d1257b7ddd15562d561cd48871d300;␊
function _getC7Storage() private pure returns (C7Storage storage $) {␊
assembly {␊
Expand All @@ -173,7 +173,7 @@ Generated by [AVA](https://avajs.dev).
}␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C8")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C8StorageLocation = 0xb93ad5010b0e46eab6ce47e44cb42c85a263d4e8daf058e8a66e4f114144f200;␊
bytes32 internal constant C8StorageLocation = 0xb93ad5010b0e46eab6ce47e44cb42c85a263d4e8daf058e8a66e4f114144f200;␊
function _getC8Storage() private pure returns (C8Storage storage $) {␊
assembly {␊
Expand Down
Binary file modified src/transform-namespaces.test.ts.snap
Binary file not shown.
Binary file modified src/transform.test.ts.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion src/transformations/add-namespace-struct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function addNamespaceStruct(include?: (source: string) => boolean) {
`}`,
``,
`// keccak256(abi.encode(uint256(keccak256("${id}")) - 1)) & ~bytes32(uint256(0xff))`,
`bytes32 private constant ${namespace}Location = ${erc7201Location(id)};`,
`bytes32 internal constant ${namespace}Location = ${erc7201Location(id)};`,
``,
`function _get${namespace}() private pure returns (${namespace} storage $) {`,
[`assembly {`, [`$.slot := ${namespace}Location`], `}`],
Expand Down