Skip to content

Commit

Permalink
added protected public beacon proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
dovgopoly committed Oct 16, 2023
1 parent 8203428 commit 8ab403f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
10 changes: 5 additions & 5 deletions contracts/factory/PoolFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import "@openzeppelin/contracts/access/Ownable.sol";

import "@solarity/solidity-lib/contracts-registry/pools/pool-factory/AbstractPoolFactory.sol";

import "@spherex-xyz/contracts/src/ProtectedProxies/ProtectedBeaconProxy.sol";

import "../interfaces/factory/IPoolFactory.sol";
import "../interfaces/core/IContractsRegistry.sol";
import "../interfaces/core/ISBT721.sol";
Expand All @@ -23,6 +21,8 @@ import "../gov/validators/GovValidators.sol";
import "../core/CoreProperties.sol";
import {PoolRegistry} from "./PoolRegistry.sol";

import "../proxy/ProtectedPublicBeaconProxy.sol";

import "../libs/factory/GovTokenDeployer.sol";

import "../core/Globals.sol";
Expand Down Expand Up @@ -257,7 +257,7 @@ contract PoolFactory is IPoolFactory, AbstractPoolFactory {
) internal override returns (address) {
return
address(
new ProtectedBeaconProxy(
new ProtectedPublicBeaconProxy(
AbstractPoolContractsRegistry(poolRegistry).getProxyBeacon(poolType),
bytes("")
)
Expand All @@ -271,7 +271,7 @@ contract PoolFactory is IPoolFactory, AbstractPoolFactory {
) internal override returns (address) {
return
address(
new ProtectedBeaconProxy{salt: salt}(
new ProtectedPublicBeaconProxy{salt: salt}(
AbstractPoolContractsRegistry(poolRegistry).getProxyBeacon(poolType),
bytes("")
)
Expand All @@ -285,7 +285,7 @@ contract PoolFactory is IPoolFactory, AbstractPoolFactory {
) internal view override returns (address) {
bytes32 bytecodeHash = keccak256(
abi.encodePacked(
type(ProtectedBeaconProxy).creationCode,
type(ProtectedPublicBeaconProxy).creationCode,
abi.encode(
AbstractPoolContractsRegistry(poolRegistry).getProxyBeacon(poolType),
bytes("")
Expand Down
14 changes: 14 additions & 0 deletions contracts/proxy/ProtectedPublicBeaconProxy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";

import "@spherex-xyz/contracts/src/ProtectedProxies/ProtectedBeaconProxy.sol";

contract ProtectedPublicBeaconProxy is ProtectedBeaconProxy {
constructor(address beacon, bytes memory data) ProtectedBeaconProxy(beacon, data) {}

function implementation() external view returns (address) {
return IBeacon(_getBeacon()).implementation();
}
}

0 comments on commit 8ab403f

Please sign in to comment.