-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDeployer.sol
80 lines (74 loc) · 2.24 KB
/
Deployer.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
import {BondToken} from "../BondToken.sol";
import {Distributor} from "../Distributor.sol";
import {LeverageToken} from "../LeverageToken.sol";
import {BeaconProxy} from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
/**
* @title Deployer
* @dev Contract for deploying BondToken and LeverageToken instances
*/
contract Deployer {
/**
* @dev Deploys a new BondToken contract
* @param bondBeacon The address of the beacon for the BondToken
* @param minter The address with minting privileges
* @param governance The address with governance privileges
* @param sharesPerToken The initial number of shares per token
* @return address of the deployed BondToken contract
*/
function deployBondToken(
address bondBeacon,
string memory name,
string memory symbol,
address minter,
address governance,
address poolFactory,
uint256 sharesPerToken
) external returns(address) {
return address(new BeaconProxy(
address(bondBeacon),
abi.encodeCall(
BondToken.initialize, (name, symbol, minter, governance, poolFactory, sharesPerToken)
)
));
}
/**
* @dev Deploys a new LeverageToken contract
* @param minter The address with minting privileges
* @param governance The address with governance privileges
* @return address of the deployed LeverageToken contract
*/
function deployLeverageToken(
address leverageBeacon,
string memory name,
string memory symbol,
address minter,
address governance,
address poolFactory
) external returns(address) {
return address(new BeaconProxy(
address(leverageBeacon),
abi.encodeCall(
LeverageToken.initialize, (name, symbol, minter, governance, poolFactory)
)
));
}
/**
* @dev Deploys a new Distributor contract
* @param pool The address of the pool
* @return address of the deployed Distributor contract
*/
function deployDistributor(
address distributorBeacon,
address pool,
address poolFactory
) external returns(address) {
return address(new BeaconProxy(
address(distributorBeacon),
abi.encodeCall(
Distributor.initialize, (pool, poolFactory)
)
));
}
}