-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mihanix
committed
Dec 2, 2023
1 parent
cd3101f
commit 374f330
Showing
2 changed files
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.19; | ||
|
||
import "@openzeppelin/contracts/proxy/Proxy.sol"; | ||
import "@openzeppelin/contracts/utils/StorageSlot.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
contract LocalReputationProxy is Proxy, Ownable { | ||
bytes32 private constant _IMPLEMENTATION_SLOT = bytes32(uint256(keccak256("id.aut.os.autid.proxy.implementation")) - 1); | ||
|
||
constructor(address implementation_) Ownable() { | ||
upgrade(implementation_); | ||
} | ||
|
||
function implementation() external view returns (address) { | ||
return _implementation(); | ||
} | ||
|
||
function upgrade(address to) public onlyOwner { | ||
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = to; | ||
} | ||
|
||
function _implementation() internal view override returns (address) { | ||
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.19; | ||
|
||
import "@openzeppelin/contracts/proxy/Proxy.sol"; | ||
import "@openzeppelin/contracts/utils/StorageSlot.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
contract LocalReputationProxy is Proxy, Ownable { | ||
bytes32 private constant _IMPLEMENTATION_SLOT = bytes32(uint256(keccak256("id.aut.os.lr.proxy.implementation")) - 1); | ||
|
||
constructor(address implementation) Ownable() { | ||
upgrade(implementation); | ||
} | ||
|
||
function upgrade(address to) public onlyOwner { | ||
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = to; | ||
} | ||
|
||
function _implementation() internal view override returns (address) { | ||
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; | ||
} | ||
} |