Skip to content

Commit 993fd72

Browse files
authored
Merge pull request #19 from dev-protocol/feat-update-sbtfactory
feat: make sbt factory upgradeable
2 parents 4639417 + ae53c03 commit 993fd72

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

contracts/SBTFactory.sol

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// SPDX-License-Identifier: MPL-2.0
22
pragma solidity =0.8.9;
33

4-
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
4+
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
55

66
import {SBT} from "./SBT.sol";
77
import {SBTProxy} from "./SBTProxy.sol";
8+
import {ISBTFactory} from "./interfaces/ISBTFactory.sol";
89

9-
contract SBTFactory is Ownable {
10+
contract SBTFactory is ISBTFactory, OwnableUpgradeable {
1011
mapping(bytes => address) public sbtProxyMapping;
1112

1213
event SBTProxyCreated(bytes indexed identifier, address sbtProxyAddress);
@@ -15,15 +16,17 @@ contract SBTFactory is Ownable {
1516
address sbtProxyAddress
1617
);
1718

18-
constructor() {}
19+
function initialize() external initializer {
20+
__Ownable_init();
21+
}
1922

2023
function makeNewSBT(
2124
address proxyAdmin,
2225
bytes memory proxyCallData,
2326
address minterUpdater,
2427
address[] calldata minters,
2528
bytes calldata identifier
26-
) external onlyOwner returns (address) {
29+
) external override onlyOwner returns (address) {
2730
// Create the implementation.
2831
address implementation = address(
2932
new SBT{salt: keccak256(identifier)}()

contracts/SBTFactoryProxy.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// SPDX-License-Identifier: MPL-2.0
2+
pragma solidity =0.8.9;
3+
4+
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
5+
6+
contract SBTFactoryProxy is TransparentUpgradeableProxy {
7+
constructor(
8+
address _logic,
9+
address admin_,
10+
bytes memory _data
11+
) TransparentUpgradeableProxy(_logic, admin_, _data) {}
12+
}

contracts/interfaces/ISBTFactory.sol

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-License-Identifier: MPL-2.0
2+
pragma solidity =0.8.9;
3+
4+
interface ISBTFactory {
5+
/*
6+
* @dev makes new SBT contract which is upgradeable.
7+
* @param proxyAdmin owner of the proxy contract which will be deployed.
8+
* @param proxyCallData the data which denotes function calls, etc when deploying new proxy contract.
9+
* @param minterUpdater the address which can add/remove minter access eoa.
10+
* @param minters the array of minters which have rights to mint new sbts.
11+
* @param identifier unique bytes to identify a deployed sbt proxy.
12+
* @return uint256[] token id list
13+
*/
14+
function makeNewSBT(
15+
address proxyAdmin,
16+
bytes memory proxyCallData,
17+
address minterUpdater,
18+
address[] calldata minters,
19+
bytes calldata identifier
20+
) external returns (address);
21+
}

0 commit comments

Comments
 (0)