-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeployYearnBorgCompensationPrerequisites.s.sol
More file actions
80 lines (64 loc) · 3.11 KB
/
deployYearnBorgCompensationPrerequisites.s.sol
File metadata and controls
80 lines (64 loc) · 3.11 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
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: AGPL-3.0-only
pragma solidity ^0.8.24;
import {YearnBorgCompensation2025_2026} from "./lib/YearnBorgCompensation2025_2026.sol";
import {YearnBorgCompensationSepolia2025_2026} from "./lib/YearnBorgCompensationSepolia2025_2026.sol";
import {ISafeProxyFactory, IGnosisSafe, GnosisTransaction} from "../test/lib/safe.sol";
import {BorgAuth} from "cybercorps-contracts/src/libs/auth.sol";
import {CyberAgreementRegistry} from "cybercorps-contracts/src/CyberAgreementRegistry.sol";
import {ERC1967Proxy} from "openzeppelin-contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {SafeTxHelper} from "./lib/SafeTxHelper.sol";
import {Script} from "forge-std/Script.sol";
import {MetaVesTControllerFactory} from "../src/MetaVesTControllerFactory.sol";
import {console2} from "forge-std/console2.sol";
import {metavestController} from "../src/MetaVesTController.sol";
contract DeployYearnBorgCompensationPrerequisitesScript is SafeTxHelper, Script {
using YearnBorgCompensation2025_2026 for YearnBorgCompensation2025_2026.Config;
/// @dev For running from `forge script`. Provide the deployer private key through env var.
function run() public virtual {
deployPrerequisites(
vm.envUint("DEPLOYER_PRIVATE_KEY"),
// // Ethereum mainnet
// "MetaLexMetaVestYearnBorgCompensationLaunchV1.0",
// YearnBorgCompensation2025_2026.getDefault(vm)
// Sepolia testnet
"MetaLexMetaVestYearnBorgCompensationLaunch-testnet-V0.1",
YearnBorgCompensationSepolia2025_2026.getDefault(vm)
);
}
/// @dev For running in tests
function deployPrerequisites(
uint256 deployerPrivateKey,
string memory saltStr,
YearnBorgCompensation2025_2026.Config memory config
) public virtual returns(
MetaVesTControllerFactory
) {
address deployer = vm.addr(deployerPrivateKey);
BorgAuth auth = config.registry.AUTH();
console2.log("");
console2.log("=== DeployYearnBorgCompensationPrerequisitesScript ===");
console2.log("Deployer: ", deployer);
console2.log("Salt string: ", saltStr);
console2.log("CyberAgreementRegistry: ", address(config.registry));
console2.log("Auth: ", address(auth));
console2.log("");
bytes32 salt = keccak256(bytes(saltStr));
vm.startBroadcast(deployerPrivateKey);
// Deploy MetaVesT pre-requisites
MetaVesTControllerFactory metavestControllerFactory = MetaVesTControllerFactory(address(new ERC1967Proxy{salt: salt}(
address(new MetaVesTControllerFactory{salt: salt}()),
abi.encodeWithSelector(
MetaVesTControllerFactory.initialize.selector,
address(auth),
address(config.registry),
new metavestController{salt: salt}()
)
)));
vm.stopBroadcast();
// Output logs
console2.log("Deployed addresses:");
console2.log(" MetaVesTControllerFactory: ", address(metavestControllerFactory));
console2.log("");
return metavestControllerFactory;
}
}