-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from loreum-org/feat/upgradeable
Feat/upgradeable
- Loading branch information
Showing
10 changed files
with
340 additions
and
224 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Loreum Chamber v1 | ||
|
||
pragma solidity 0.8.19; | ||
|
||
|
||
import { IERC20 } from "openzeppelin-contracts/contracts/interfaces/IERC20.sol"; | ||
import { IERC721 } from "openzeppelin-contracts/contracts/interfaces/IERC721.sol"; | ||
import { Context } from "openzeppelin-contracts/contracts/utils/Context.sol"; | ||
import { SafeERC20 } from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; | ||
import { ERC721Holder } from "openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol"; | ||
import { ERC1155Holder } from "openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Holder.sol"; | ||
import { Initializable } from "openzeppelin-contracts/contracts/proxy/utils/Initializable.sol"; | ||
import { ReentrancyGuard } from "openzeppelin-contracts/contracts/security/ReentrancyGuard.sol"; | ||
|
||
abstract contract Common is Initializable, ReentrancyGuard, Context, ERC721Holder, ERC1155Holder {} |
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,35 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Loreum Chamber v1 | ||
|
||
pragma solidity 0.8.19; | ||
|
||
import { IProxyChamber } from "./interfaces/IProxyChamber.sol"; | ||
import { ERC1967Proxy } from "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
contract ProxyChamber is IProxyChamber, ERC1967Proxy { | ||
|
||
modifier onlyAdmin() { | ||
if(msg.sender != super._getAdmin()) revert notAdmin(); | ||
_; | ||
} | ||
|
||
constructor(address _logic, bytes memory _data, address _admin) ERC1967Proxy(_logic, _data) { | ||
super._changeAdmin(_admin); | ||
} | ||
|
||
function getImplementation() public view returns (address) { | ||
return super._implementation(); | ||
} | ||
|
||
function getAdmin() public view returns (address) { | ||
return super._getAdmin(); | ||
} | ||
|
||
function changeAdmin(address newAdmin) public onlyAdmin { | ||
super._changeAdmin(newAdmin); | ||
} | ||
|
||
function upgradeTo(address newImplementation) public onlyAdmin { | ||
super._upgradeTo(newImplementation); | ||
} | ||
} |
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
Oops, something went wrong.