-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDistributorFactory.sol
More file actions
37 lines (30 loc) · 1.15 KB
/
Copy pathDistributorFactory.sol
File metadata and controls
37 lines (30 loc) · 1.15 KB
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
pragma solidity ^0.8.10;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {ITrueDistributor} from "./interfaces/ITrueDistributor.sol";
interface IOwnable {
function transferOwnership(address newOwner) external;
}
contract DistributorFactory {
event DistributorCreated(ITrueDistributor distributor);
address public implementation;
address public multifarm;
ITrueDistributor[] public distributors;
constructor(address _implementation, address _multifarm) {
implementation = _implementation;
multifarm = _multifarm;
}
function create(
uint256 _distributionStart,
uint256 _duration,
uint256 _amount,
IERC20 _rewardToken
) external {
ITrueDistributor deployed = ITrueDistributor(Clones.clone(implementation));
deployed.initialize(_distributionStart, _duration, _amount, _rewardToken);
deployed.setFarm(multifarm);
IOwnable(address(deployed)).transferOwnership(msg.sender);
distributors.push(deployed);
emit DistributorCreated(deployed);
}
}