UNPKG

@solvprotocol/upgrade-safe-transpiler

Version:

Solidity preprocessor used to generate OpenZeppelin Contracts Upgrade Safe.

652 lines (607 loc) 22.4 kB
# Snapshot report for `src/index.test.ts` The actual snapshot is saved in `index.test.ts.snap`. Generated by [AVA](https://avajs.dev). ## ClassInheritance.sol > Snapshot 1 { fileName: 'ClassInheritance.sol', path: 'contracts/solc-0.6/ClassInheritanceUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ interface CICUpgradeable {␊ function fooBar(uint a) external;␊ }␊ ␊ contract CIAUpgradeable is Initializable {␊ uint256 public foo;␊ event log(string);␊ function __CIA_init(uint bar) internal onlyInitializing {␊ __CIA_init_unchained(bar);␊ }␊ ␊ function __CIA_init_unchained(uint bar) internal onlyInitializing {␊ foo = bar;␊ emit log("SIA");␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ ␊ contract CIBUpgradeable is Initializable, CIAUpgradeable {␊ function __CIB_init() internal onlyInitializing {␊ __CIA_init_unchained(324);␊ __CIB_init_unchained();␊ }␊ ␊ function __CIB_init_unchained() internal onlyInitializing {␊ val = 123;␊ }␊ uint256 public val;␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ ␊ contract CIDUpgradeable is Initializable, CICUpgradeable {␊ function __CID_init() internal onlyInitializing {␊ __CID_init_unchained();␊ }␊ ␊ function __CID_init_unchained() internal onlyInitializing {␊ val = 123;␊ }␊ uint256 public val;␊ ␊ function fooBar(uint a) override external{␊ ␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ `, } ## Override.sol > Snapshot 1 { fileName: 'Override.sol', path: 'contracts/solc-0.6/OverrideUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ contract Parent1Upgradeable is Initializable {␊ function __Parent1_init() internal onlyInitializing {␊ }␊ ␊ function __Parent1_init_unchained() internal onlyInitializing {␊ }␊ function foo() public virtual {␊ }␊ ␊ function bar() public virtual {␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ ␊ contract Parent2Upgradeable is Initializable {␊ function __Parent2_init() internal onlyInitializing {␊ }␊ ␊ function __Parent2_init_unchained() internal onlyInitializing {␊ }␊ function foo() public virtual {␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ ␊ contract ChildUpgradeable is Initializable, Parent1Upgradeable, Parent2Upgradeable {␊ function __Child_init() internal onlyInitializing {␊ }␊ ␊ function __Child_init_unchained() internal onlyInitializing {␊ }␊ function foo() public override(Parent1Upgradeable, Parent2Upgradeable) {␊ }␊ ␊ function bar() public override {␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ `, } ## DiamondInheritance.sol > Snapshot 1 { fileName: 'DiamondInheritance.sol', path: 'contracts/solc-0.6/DiamondInheritanceUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ contract DAUpgradeable is Initializable {␊ event Log(string);␊ uint256 public foo;␊ function __DA_init() internal onlyInitializing {␊ __DA_init_unchained();␊ }␊ ␊ function __DA_init_unchained() internal onlyInitializing {␊ foo = 42;␊ emit Log("DA");␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ ␊ contract DB1Upgradeable is Initializable, DAUpgradeable {␊ string public hello;␊ function __DB1_init() internal onlyInitializing {␊ __DA_init_unchained();␊ __DB1_init_unchained();␊ }␊ ␊ function __DB1_init_unchained() internal onlyInitializing {␊ hello = "hello";␊ emit Log("DB1");␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ ␊ contract DB2Upgradeable is Initializable, DAUpgradeable {␊ bool public bar;␊ function __DB2_init() internal onlyInitializing {␊ __DA_init_unchained();␊ __DB2_init_unchained();␊ }␊ ␊ function __DB2_init_unchained() internal onlyInitializing {␊ bar = true;␊ emit Log("DB2");␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ ␊ contract DCUpgradeable is Initializable, DB2Upgradeable, DB1Upgradeable {␊ address public owner;␊ function __DC_init() internal onlyInitializing {␊ __DA_init_unchained();␊ __DB2_init_unchained();␊ __DB1_init_unchained();␊ __DC_init_unchained();␊ }␊ ␊ function __DC_init_unchained() internal onlyInitializing {␊ owner = address(0x123);␊ emit Log("DC");␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ `, } ## Deep.sol > Snapshot 1 { fileName: 'Deep.sol', path: 'contracts/solc-0.6/one/two/three/DeepUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ ␊ import "../../../ElementaryTypesUpgradeable.sol";␊ import "../../../../Initializable.sol";␊ ␊ contract DeepUpgradeable is Initializable {␊ function __Deep_init() internal onlyInitializing {␊ }␊ ␊ function __Deep_init_unchained() internal onlyInitializing {␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ `, } ## ElementaryTypes.sol > Snapshot 1 { fileName: 'ElementaryTypes.sol', path: 'contracts/solc-0.6/ElementaryTypesUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ contract ElementaryTypesUpgradeable is Initializable {␊ function __ElementaryTypes_init() internal onlyInitializing {␊ __ElementaryTypes_init_unchained();␊ }␊ ␊ function __ElementaryTypes_init_unchained() internal onlyInitializing {␊ owner = address(0x123);␊ active = true;␊ hello = "hello";␊ count = -123;␊ ucount = 123;␊ samevar = "stringliteral";␊ x = 5;␊ y = 4;␊ }␊ address public owner;␊ bool active;␊ string hello;␊ int count;␊ uint ucount;␊ bytes32 samevar;␊ uint x;␊ uint y;␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[43] private __gap;␊ }␊ `, } ## ElementaryTypesWithConstructor.sol > Snapshot 1 { fileName: 'ElementaryTypesWithConstructor.sol', path: 'contracts/solc-0.6/ElementaryTypesWithConstructorUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ contract ElementaryTypesWithConstructorUpgradeable is Initializable {␊ address public owner;␊ bool active;␊ string hello;␊ int count;␊ uint ucount;␊ bytes32 samevar;␊ ␊ function __ElementaryTypesWithConstructor_init() internal onlyInitializing {␊ __ElementaryTypesWithConstructor_init_unchained();␊ }␊ ␊ function __ElementaryTypesWithConstructor_init_unchained() internal onlyInitializing {␊ owner = address(0x123);␊ active = true;␊ hello = "hello";␊ count = -123;␊ ucount = 123;␊ samevar = "stringliteral";␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[45] private __gap;␊ }␊ `, } ## Imported.sol > Snapshot 1 { fileName: 'Imported.sol', path: 'contracts/solc-0.6/ImportedUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ contract Imported1Upgradeable is Initializable {␊ function __Imported1_init(uint256 x, uint256 y) internal onlyInitializing {␊ }␊ ␊ function __Imported1_init_unchained(uint256, uint256) internal onlyInitializing { }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ ␊ contract Imported2Upgradeable is Initializable, Imported1Upgradeable {␊ function __Imported2_init(uint256 x, uint256 y) internal onlyInitializing {␊ __Imported1_init_unchained(x, y);␊ }␊ ␊ function __Imported2_init_unchained(uint256, uint256) internal onlyInitializing { }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ `, } ## Local.sol > Snapshot 1 { fileName: 'Local.sol', path: 'contracts/solc-0.6/LocalUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ ␊ import "./ImportedUpgradeable.sol";␊ import "../Initializable.sol";␊ ␊ contract LocalUpgradeable is Initializable, Imported2Upgradeable {␊ function __Local_init(uint x, uint y) internal onlyInitializing {␊ __Imported1_init_unchained(x, y);␊ __Imported2_init_unchained(x, y);␊ }␊ ␊ function __Local_init_unchained(uint, uint) internal onlyInitializing { }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ `, } ## SimpleInheritance.sol > Snapshot 1 { fileName: 'SimpleInheritance.sol', path: 'contracts/solc-0.6/SimpleInheritanceUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ contract SIAUpgradeable is Initializable {␊ uint256 public foo;␊ event log(string);␊ function __SIA_init() internal onlyInitializing {␊ __SIA_init_unchained();␊ }␊ ␊ function __SIA_init_unchained() internal onlyInitializing {␊ emit log("SIA");␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ ␊ contract SIBUpgradeable is Initializable, SIAUpgradeable {␊ function __SIB_init() internal onlyInitializing {␊ __SIA_init_unchained();␊ __SIB_init_unchained();␊ }␊ ␊ function __SIB_init_unchained() internal onlyInitializing {␊ val = 123;␊ }␊ uint256 public val;␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ ␊ contract SICUpgradeable is Initializable, SIBUpgradeable {␊ string public bar;␊ function __SIC_init() internal onlyInitializing {␊ __SIA_init_unchained();␊ __SIB_init_unchained();␊ __SIC_init_unchained();␊ }␊ ␊ function __SIC_init_unchained() internal onlyInitializing {␊ bar = "hello";␊ bar = "changed";␊ emit log("SIC");␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ `, } ## StringConstructor.sol > Snapshot 1 { fileName: 'StringConstructor.sol', path: 'contracts/solc-0.6/StringConstructorUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ contract StringConstructorUpgradeable is Initializable {␊ ␊ modifier hasModifier() {␊ _;␊ }␊ ␊ function __StringConstructor_init(string memory message) internal onlyInitializing {␊ __StringConstructor_init_unchained(message);␊ }␊ ␊ function __StringConstructor_init_unchained(string memory) internal onlyInitializing hasModifier {␊ ␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ `, } ## Library.sol > Snapshot 1 { fileName: 'Library.sol', path: 'contracts/solc-0.6/LibraryUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ ␊ library LibraryUpgradeable {␊ }␊ `, } ## AbstractContract.sol > Snapshot 1 { fileName: 'AbstractContract.sol', path: 'contracts/solc-0.6/AbstractContractUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ abstract contract AbstractContractUpgradeable is Initializable {␊ function __AbstractContract_init() internal onlyInitializing {␊ }␊ ␊ function __AbstractContract_init_unchained() internal onlyInitializing {␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ `, } ## Interface.sol > Snapshot 1 { fileName: 'Interface.sol', path: 'contracts/solc-0.6/InterfaceUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ ␊ interface InterfaceUpgradeable {␊ }␊ `, } ## Rename.sol > Snapshot 1 { fileName: 'Rename.sol', path: 'contracts/solc-0.6/RenameUpgradeable.sol', source: `pragma solidity ^0.6.0;␊ import "../Initializable.sol";␊ ␊ library RenameLibraryUpgradeable {␊ function test() external {␊ }␊ }␊ ␊ contract RenameContractUpgradeable is Initializable {␊ function __RenameContract_init() internal onlyInitializing {␊ }␊ ␊ function __RenameContract_init_unchained() internal onlyInitializing {␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[50] private __gap;␊ }␊ ␊ contract RenameDeployerUpgradeable is Initializable {␊ RenameContractUpgradeable rc;␊ ␊ function __RenameDeployer_init() internal onlyInitializing {␊ __RenameDeployer_init_unchained();␊ }␊ ␊ function __RenameDeployer_init_unchained() internal onlyInitializing {␊ rc = RenameContractUpgradeable(0);␊ new RenameContractUpgradeable();␊ }␊ ␊ function deploy() external returns (RenameContractUpgradeable) {␊ return new RenameContractUpgradeable();␊ }␊ ␊ function test() external {␊ RenameLibraryUpgradeable.test();␊ }␊ ␊ /**␊ * @dev This empty reserved space is put in place to allow future versions to add new␊ * variables without shifting down storage in the inheritance chain.␊ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps␊ */␊ uint256[49] private __gap;␊ }␊ `, }