-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreateAllTemplates.s.sol
More file actions
66 lines (59 loc) · 2.75 KB
/
createAllTemplates.s.sol
File metadata and controls
66 lines (59 loc) · 2.75 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
// 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 {VestingAllocationFactory} from "../src/VestingAllocationFactory.sol";
import {console2} from "forge-std/console2.sol";
import {metavestController} from "../src/MetaVesTController.sol";
contract CreateAllTemplatesScript is SafeTxHelper, Script {
/// @dev For running from `forge script`
function run() public virtual {
run(
// // Ethereum mainnet
// YearnBorgCompensation2025_2026.getDefault(vm)
// Sepolia testnet
YearnBorgCompensationSepolia2025_2026.getDefault(vm)
);
}
/// @dev For running in tests
function run(
YearnBorgCompensation2025_2026.Config memory config
) public virtual returns(GnosisTransaction[] memory) {
GnosisTransaction[] memory safeTxs = new GnosisTransaction[](config.compRecipients.length);
for (uint i = 0; i < config.compRecipients.length ; i++) {
YearnBorgCompensation2025_2026.CompInfo memory compRecipient = config.compRecipients[i];
safeTxs[i] = GnosisTransaction({
to: address(config.registry),
value: 0 ether,
data: abi.encodeWithSelector(
CyberAgreementRegistry.createTemplate.selector,
compRecipient.compTemplate.id,
compRecipient.compTemplate.name,
compRecipient.compTemplate.agreementUri,
compRecipient.compTemplate.globalFields,
compRecipient.compTemplate.partyFields
)
});
}
// Output logs
console2.log("");
console2.log("=== CreateAllTemplatesScript ===");
console2.log("Safe: ", address(config.metalexSafe));
console2.log("Safe TXs:");
for (uint256 i = 0 ; i < safeTxs.length ; i++) {
console2.log(" #", i);
console2.log(" to:", safeTxs[i].to);
console2.log(" value:", safeTxs[i].value);
console2.log(" data:");
console2.logBytes(safeTxs[i].data);
console2.log("");
}
return safeTxs;
}
}