-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathConvexDepositFactory.sol
42 lines (31 loc) · 1.27 KB
/
ConvexDepositFactory.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@openzeppelin/contracts/proxy/Clones.sol";
import "../../dependencies/PrismaOwnable.sol";
interface IConvexDepositToken {
function initialize(uint256 pid) external;
}
/**
@notice Prisma Convex Factory
@title Deploys clones of `ConvexDepositToken` as directed by the Prisma DAO
*/
contract ConvexFactory is PrismaOwnable {
using Clones for address;
address public depositTokenImpl;
event NewDeployment(uint256 pid, address depositToken);
constructor(address _prismaCore, address _depositTokenImpl) PrismaOwnable(_prismaCore) {
depositTokenImpl = _depositTokenImpl;
}
/**
@dev After calling this function, the owner should also call `Treasury.registerReceiver`
to enable PRISMA emissions on the newly deployed `ConvexDepositToken`
*/
function deployNewInstance(uint256 pid) external onlyOwner {
address depositToken = depositTokenImpl.cloneDeterministic(bytes32(pid));
IConvexDepositToken(depositToken).initialize(pid);
emit NewDeployment(pid, depositToken);
}
function getDepositToken(uint256 pid) external view returns (address) {
return Clones.predictDeterministicAddress(depositTokenImpl, bytes32(pid));
}
}