-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathControllerDeploy.sol
107 lines (95 loc) · 2.84 KB
/
ControllerDeploy.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >=0.8.0;
import { ALMProxy } from "src/ALMProxy.sol";
import { ForeignController } from "src/ForeignController.sol";
import { MainnetController } from "src/MainnetController.sol";
import { RateLimits } from "src/RateLimits.sol";
import { ControllerInstance } from "./ControllerInstance.sol";
library ForeignControllerDeploy {
function deployController(
address admin,
address almProxy,
address rateLimits,
address psm,
address usdc,
address cctp
)
internal returns (address controller)
{
controller = address(new ForeignController({
admin_ : admin,
proxy_ : almProxy,
rateLimits_ : rateLimits,
psm_ : psm,
usdc_ : usdc,
cctp_ : cctp
}));
}
function deployFull(
address admin,
address psm,
address usdc,
address cctp
)
internal returns (ControllerInstance memory instance)
{
instance.almProxy = address(new ALMProxy(admin));
instance.rateLimits = address(new RateLimits(admin));
instance.controller = address(new ForeignController({
admin_ : admin,
proxy_ : instance.almProxy,
rateLimits_ : instance.rateLimits,
psm_ : psm,
usdc_ : usdc,
cctp_ : cctp
}));
}
}
library MainnetControllerDeploy {
function deployController(
address admin,
address almProxy,
address rateLimits,
address vault,
address psm,
address daiUsds,
address cctp,
address susds
)
internal returns (address controller)
{
controller = address(new MainnetController({
admin_ : admin,
proxy_ : almProxy,
rateLimits_ : rateLimits,
vault_ : vault,
psm_ : psm,
daiUsds_ : daiUsds,
cctp_ : cctp,
susds_ : susds
}));
}
function deployFull(
address admin,
address vault,
address psm,
address daiUsds,
address cctp,
address susds
)
internal returns (ControllerInstance memory instance)
{
instance.almProxy = address(new ALMProxy(admin));
instance.rateLimits = address(new RateLimits(admin));
instance.controller = address(new MainnetController({
admin_ : admin,
proxy_ : instance.almProxy,
rateLimits_ : instance.rateLimits,
vault_ : vault,
psm_ : psm,
daiUsds_ : daiUsds,
cctp_ : cctp,
susds_ : susds
}));
}
}