-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove OwnableUpgradeable and create local owner storage
- Loading branch information
1 parent
357d682
commit 25eba62
Showing
4 changed files
with
44 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
// SPDX-FileCopyrightText: 2024 IEXEC BLOCKCHAIN TECH <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pragma solidity ^0.8.20; | ||
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | ||
|
||
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
pragma solidity ^0.8.20; | ||
|
||
contract VoucherV2Mock is OwnableUpgradeable { | ||
contract VoucherV2Mock is Initializable { | ||
/// @custom:storage-location erc7201:iexec.voucher.storage.Voucher | ||
struct VoucherStorage { | ||
address _voucherHub; | ||
uint256 _expiration; | ||
uint256 _type; | ||
mapping(address => bool) _authorizedAccounts; | ||
mapping(bytes32 dealId => uint256) _sponsoredAmounts; | ||
address _owner; | ||
uint256 _newStateVariable; | ||
} | ||
|
||
|
@@ -21,16 +22,11 @@ contract VoucherV2Mock is OwnableUpgradeable { | |
bytes32 private constant VOUCHER_STORAGE_LOCATION = | ||
0xc2e244293dc04d6c7fa946e063317ff8e6770fd48cbaff411a60f1efc8a7e800; | ||
|
||
/// @custom:oz-upgrades-unsafe-allow constructor | ||
constructor() { | ||
_disableInitializers(); | ||
} | ||
|
||
/** | ||
* Initialize new implementation contract. | ||
* @param newStateVariable test variable. | ||
*/ | ||
function initializeV2(uint256 newStateVariable) external reinitializer(2) { | ||
function initializeV2(uint256 newStateVariable) external { | ||
VoucherStorage storage $ = _getVoucherStorage(); | ||
$._newStateVariable = newStateVariable; | ||
} | ||
|
@@ -44,6 +40,10 @@ contract VoucherV2Mock is OwnableUpgradeable { | |
VoucherStorage storage $ = _getVoucherStorage(); | ||
return $._newStateVariable; | ||
} | ||
function owner() public view returns (address) { | ||
VoucherStorage storage $ = _getVoucherStorage(); | ||
return $._owner; | ||
} | ||
|
||
function _getVoucherStorage() private pure returns (VoucherStorage storage $) { | ||
assembly { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters