@openzeppelin/upgrade-safe-transpiler
Version:
Solidity preprocessor used to generate OpenZeppelin Contracts Upgrade Safe.
195 lines (189 loc) • 6.5 kB
Markdown
The actual snapshot is saved in `transform-namespaces.test.ts.snap`.
Generated by [AVA](https://avajs.dev).
> Snapshot 1
`// SPDX-License-Identifier: UNLICENSED␊
pragma solidity ^0.8.20;␊
␊
contract C1 {␊
function __C1_init() internal onlyInitializing {␊
}␊
␊
function __C1_init_unchained() internal onlyInitializing {␊
}␊
}␊
␊
contract C2 {␊
event B();␊
␊
struct A { uint z; }␊
␊
uint constant C = 3;␊
// b␊
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable␊
uint immutable y = 2;␊
␊
/// @custom:storage-location erc7201:openzeppelin.storage.C2␊
struct C2Storage {␊
// a␊
uint x;␊
uint z;␊
␊
string s1;␊
}␊
␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C2")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C2StorageLocation = 0xf05a05e0e3d15983ea921cad031aaea3040e9d631039045748753d29c5d24800;␊
␊
function _getC2Storage() private pure returns (C2Storage storage $) {␊
assembly {␊
$.slot := C2StorageLocation␊
}␊
}␊
␊
function __C2_init() internal onlyInitializing {␊
__C2_init_unchained();␊
}␊
␊
function __C2_init_unchained() internal onlyInitializing {␊
C2Storage storage $ = _getC2Storage();␊
$.s1 = "";␊
}␊
function f() public {␊
C2Storage storage $ = _getC2Storage();␊
$.z = 3;␊
}␊
␊
function g() public {␊
}␊
}␊
␊
contract C3 {␊
function __C3_init() internal onlyInitializing {␊
}␊
␊
function __C3_init_unchained() internal onlyInitializing {␊
}␊
/// @custom:storage-location erc7201:openzeppelin.storage.C3␊
struct C3Storage {␊
address x;␊
}␊
␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C3")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C3StorageLocation = 0xaa7e0685867d809c517036b8f21e99d58bd04b1da2b202f167c355fdf82b4a00;␊
␊
function _getC3Storage() private pure returns (C3Storage storage $) {␊
assembly {␊
$.slot := C3StorageLocation␊
}␊
}␊
}␊
␊
contract C4 {␊
/// @custom:storage-location erc7201:openzeppelin.storage.C4␊
struct C4Storage {␊
address x;␊
}␊
␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C4")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C4StorageLocation = 0x536a56e760d844b098efcc16711808e0b18bad9e07c2e82c78312ab719318d00;␊
␊
function _getC4Storage() private pure returns (C4Storage storage $) {␊
assembly {␊
$.slot := C4StorageLocation␊
}␊
}␊
function __C4_init() internal onlyInitializing {␊
__C4_init_unchained();␊
}␊
␊
function __C4_init_unchained() internal onlyInitializing {␊
C4Storage storage $ = _getC4Storage();␊
$.x = msg.sender;␊
}␊
}␊
␊
contract C5 {␊
function __C5_init() internal onlyInitializing {␊
__C5_init_unchained();␊
}␊
␊
function __C5_init_unchained() internal onlyInitializing {␊
C5Storage storage $ = _getC5Storage();␊
$.x = msg.sender;␊
}␊
/// @custom:storage-location erc7201:openzeppelin.storage.C5␊
struct C5Storage {␊
address x;␊
}␊
␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C5")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C5StorageLocation = 0xd94dd1cf5c0ce3bfbbd2555b11ad43bf11eeff03081ca744441b0fb7c0a6ec00;␊
␊
function _getC5Storage() private pure returns (C5Storage storage $) {␊
assembly {␊
$.slot := C5StorageLocation␊
}␊
}␊
}␊
␊
contract C6 {␊
function __C6_init() internal onlyInitializing {␊
}␊
␊
function __C6_init_unchained() internal onlyInitializing {␊
}␊
}␊
␊
contract C7 {␊
function __C7_init() internal onlyInitializing {␊
}␊
␊
function __C7_init_unchained() internal onlyInitializing {␊
}␊
/// @custom:storage-location erc7201:openzeppelin.storage.C7␊
struct C7Storage {␊
uint x; // a comment␊
␊
uint y;␊
}␊
␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C7")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C7StorageLocation = 0x931371859ca5c5440d3850c7cf9c14adb9d1257b7ddd15562d561cd48871d300;␊
␊
function _getC7Storage() private pure returns (C7Storage storage $) {␊
assembly {␊
$.slot := C7StorageLocation␊
}␊
}␊
// a separate comment␊
}␊
␊
contract C8 {␊
/// @custom:storage-location erc7201:openzeppelin.storage.C8␊
struct C8Storage {␊
address x;␊
address y;␊
}␊
␊
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.C8")) - 1)) & ~bytes32(uint256(0xff))␊
bytes32 private constant C8StorageLocation = 0xb93ad5010b0e46eab6ce47e44cb42c85a263d4e8daf058e8a66e4f114144f200;␊
␊
function _getC8Storage() private pure returns (C8Storage storage $) {␊
assembly {␊
$.slot := C8StorageLocation␊
}␊
}␊
␊
function __C8_init() internal onlyInitializing {␊
__C8_init_unchained();␊
}␊
␊
function __C8_init_unchained() internal onlyInitializing {␊
C8Storage storage $ = _getC8Storage();␊
$.y = address(this);␊
$.x = msg.sender;␊
}␊
}␊
`