Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
2768028
wip: fix: disable all legacy tests
Detoo Jul 28, 2025
3ab97ba
test: integrate MetaVesT and ZkCappendMinter on zkSync Era Sepolia. F…
Detoo Jul 29, 2025
393b211
test: add more comments
Detoo Jul 30, 2025
6abd05e
feat: Use ZkCappedMinterV2
Detoo Jul 30, 2025
c98c9a3
feat: simplify TPP approval by pairing a single ZkCappedMinter with M…
Detoo Jul 30, 2025
50103d6
feat: solve circular dependency between MetaVesTController and ZkCapp…
Detoo Jul 31, 2025
46f3dfd
feat: test multiple grantee
Detoo Jul 31, 2025
c1ba277
test: fix old tests. Fixed add/remove milestones
Detoo Jul 31, 2025
02b9fd5
wip: test: disable breaking tests due to upcoming changes
Detoo Jul 31, 2025
bc572a6
wip: feat: grantee registration
Detoo Jul 31, 2025
b02dc6b
feat: agreement signature
Detoo Aug 1, 2025
5e98f8b
feat: signing delegation
Detoo Aug 1, 2025
9212f46
feat: temporarily remove WIP metavest types. Add more realistic test …
Detoo Aug 2, 2025
338e455
test: Move MetaVesTController unit tests to dedicated file
Detoo Aug 2, 2025
8a49284
test: combine all MetaVesTController unit tests
Detoo Aug 2, 2025
6674b79
test: fix all the rest
Detoo Aug 3, 2025
0d97fbf
wip: test: temporarily remove breaking tests
Detoo Aug 6, 2025
5091341
chore: add dependencies to CyberAgreementRegistry
Detoo Aug 6, 2025
2087528
wip: feat: adopt CyberAgreementRegistry
Detoo Aug 6, 2025
520bbdd
feat: refactor deal structures
Detoo Aug 6, 2025
00b8a07
wip: test: update all to specs
Detoo Aug 6, 2025
fb0b350
Revert "wip: test: temporarily remove breaking tests"
Detoo Aug 6, 2025
aa4a72e
test: update all to specs
Detoo Aug 6, 2025
2b5a6e1
feat: add recipient
Detoo Aug 7, 2025
e306403
feat: pause/close minting
Detoo Aug 7, 2025
9e6eb46
feat: update agreement template fields
Detoo Aug 11, 2025
6ebb078
chore: remove unused codes
Detoo Aug 11, 2025
f4614e0
feat: improve deal proposal flow
Detoo Aug 12, 2025
318678c
feat: make MetaVesTController upgradeable
Detoo Aug 12, 2025
a1f3584
feat: add metavest address to DealData for better UX
Detoo Aug 13, 2025
cc39911
test: update template to specs
Detoo Aug 13, 2025
225923e
wip: chore: add production deploy scripts
Detoo Aug 21, 2025
e8ca3e2
wip: chore: add production deploy scripts
Detoo Aug 21, 2025
791acb7
chore: add MetaLeX SAFE address
Detoo Aug 22, 2025
51dab55
chore: add post-deployment verification
Detoo Aug 22, 2025
2ff5aab
feat: accommodate cases when MetaVesTController is not the admin of Z…
Detoo Aug 22, 2025
b423016
chore: commit modified zk-governance library for compiler version con…
Detoo Aug 22, 2025
38c56c2
wip: test: integrate deploy scripts to tests
Detoo Aug 25, 2025
bd83d3a
test: add tests to proposeServiceAgreement scripts
Detoo Aug 25, 2025
e50e43c
chore: unify naming
Detoo Aug 25, 2025
50dca57
test: integrate deploy scripts to tests (full deal lifecycle)
Detoo Aug 26, 2025
7745b5d
chore: refactor deploy scripts and use dynamic configs
Detoo Aug 26, 2025
7230df1
chore: simplify config helpers and logging
Detoo Aug 26, 2025
66a8c61
chore: add configs and scripts for testnet deployment
Detoo Aug 26, 2025
e602a7a
chore: add scripts for proposing service agreements and void contract…
Detoo Aug 27, 2025
e6d7578
test: verify audit M-01
Detoo Aug 27, 2025
d206cc0
fix: M-01: Governing power calculation may revert after vesting rate …
Detoo Aug 27, 2025
3428854
chore: add script to create transactions for SAFE
Detoo Aug 28, 2025
6168365
feat: remove service-agreement and unused metavest-agreement party fi…
Detoo Aug 28, 2025
6019fa8
feat: adjust agreement expiry per request
Detoo Aug 28, 2025
7e0cfeb
chore: deploy production pre-requisites
Detoo Aug 28, 2025
9439923
feat: add BORG Resolution proposal
Detoo Aug 29, 2025
af331ba
chore: handle guardian-specific template ID in deployment
Detoo Aug 29, 2025
6318cb8
chore: update production deployed address
Detoo Aug 29, 2025
1f0a389
chore: update scripts for production template creation
Detoo Aug 29, 2025
bdbe3e2
chore: load guardians and template info from env vars
Detoo Sep 2, 2025
46d60ee
chore: refactor proposeMetavestDeal scripts for modularity
Detoo Sep 2, 2025
0c569aa
test: add acceptance tests for existing production deployment
Detoo Sep 2, 2025
89f098e
chore: load guardian SAFE delegate signatures externally if necessary
Detoo Sep 10, 2025
d09b674
chore: allow offline agreement signing
Detoo Sep 10, 2025
90d2de2
chore: separate tests with fresh deployment vs existing deployment
Detoo Sep 11, 2025
d7881cf
chore: add acceptance tests to simulate and track existing deployment
Detoo Sep 11, 2025
9f7ec5f
chore: test offline signatures with dev wallets
Detoo Sep 11, 2025
d9399f0
chore: test offline (mocked) signatures with prod wallets
Detoo Sep 11, 2025
d667670
chore: refactor acceptance tests so it tests against production env vars
Detoo Sep 11, 2025
baafce3
chore: refactor Guardian SAFE tx batch to match production scenarios
Detoo Sep 14, 2025
e82f03a
chore: prepare to create compensation agreements
Detoo Sep 15, 2025
63c129a
chore: simulate agreement creation with real signatures
Detoo Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cache/
out/
.env
.env.*
test-command.txt
broadcast/
.DS_Store
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "lib/zk-governance"]
path = lib/zk-governance
url = https://github.com/zksync-association/zk-governance
[submodule "lib/cybercorps-contracts"]
path = lib/cybercorps-contracts
url = https://github.com/MetaLex-Tech/cybercorps-contracts
1 change: 1 addition & 0 deletions lib/cybercorps-contracts
Submodule cybercorps-contracts added at e2afc8
2 changes: 1 addition & 1 deletion lib/zk-governance
3 changes: 2 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ openzeppelin-contracts/=lib/zk-governance/l1-contracts/lib/openzeppelin-contract
@openzeppelin/contracts-upgradeable=lib/zk-governance/l2-contracts/lib/openzeppelin-contracts-upgradeable/contracts
@openzeppelin/contracts/=lib/zk-governance/l2-contracts/lib/openzeppelin-contracts/contracts/
solmate/=lib/zk-governance/l2-contracts/lib/flexible-voting/lib/solmate/src/
zk-governance/=lib/zk-governance/
zk-governance/=lib/zk-governance/
cybercorps-contracts/=lib/cybercorps-contracts/
101 changes: 101 additions & 0 deletions scripts/createAllTemplates.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.24;

import {ZkSyncGuardianCompensation2024_2025} from "./lib/ZkSyncGuardianCompensation2024_2025.sol";
import {ZkSyncGuardianCompensation2025_2026} from "./lib/ZkSyncGuardianCompensation2025_2026.sol";
import {ZkSyncGuardianCompensationSepolia2024_2025} from "./lib/ZkSyncGuardianCompensationSepolia2024_2025.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 {IZkCappedMinterV2} from "../src/interfaces/zk-governance/IZkCappedMinterV2.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 {
// zkSync mainnet
run(ZkSyncGuardianCompensation2024_2025.getDefault(vm));
}

/// @dev For running in tests
function run(
ZkSyncGuardianCompensation2024_2025.Config memory config
) public virtual returns(GnosisTransaction[] memory) {
IGnosisSafe safe;
ZkSyncGuardianCompensation2024_2025.Config memory config;

// zkSync Era (zkSync Guardians)
config = ZkSyncGuardianCompensation2024_2025.getDefault(vm);

safe = config.guardianSafe;

// TODO deprecated
// GnosisTransaction[] memory safeTxs = new GnosisTransaction[](config.guardians.length + 1);
// safeTxs[0] = GnosisTransaction({
// to: address(config.registry),
// value: 0 ether,
// data: abi.encodeWithSelector(
// CyberAgreementRegistry.createTemplate.selector,
// config.borgResolutionTemplate.id,
// config.borgResolutionTemplate.name,
// config.borgResolutionTemplate.agreementUri,
// config.borgResolutionTemplate.globalFields,
// config.borgResolutionTemplate.partyFields
// )
// });
// for (uint i = 0; i < config.guardians.length ; i++) {
// ZkSyncGuardianCompensation2024_2025.GuardianCompInfo memory guardian = config.guardians[i];
// safeTxs[i + 1] = GnosisTransaction({
// to: address(config.registry),
// value: 0 ether,
// data: abi.encodeWithSelector(
// CyberAgreementRegistry.createTemplate.selector,
// guardian.compTemplate.id,
// guardian.compTemplate.name,
// guardian.compTemplate.agreementUri,
// guardian.compTemplate.globalFields,
// guardian.compTemplate.partyFields
// )
// });
// }

GnosisTransaction[] memory safeTxs = new GnosisTransaction[](config.guardians.length);
for (uint i = 0; i < config.guardians.length ; i++) {
ZkSyncGuardianCompensation2024_2025.GuardianCompInfo memory guardian = config.guardians[i];
safeTxs[i] = GnosisTransaction({
to: address(config.registry),
value: 0 ether,
data: abi.encodeWithSelector(
CyberAgreementRegistry.createTemplate.selector,
guardian.compTemplate.id,
guardian.compTemplate.name,
guardian.compTemplate.agreementUri,
guardian.compTemplate.globalFields,
guardian.compTemplate.partyFields
)
});
}

// Output logs

console2.log("");
console2.log("=== CreateAllTemplatesScript ===");
console2.log("Safe: ", address(safe));
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;
}
}
99 changes: 99 additions & 0 deletions scripts/createSafeTx.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.24;

import {ZkSyncGuardianCompensation2024_2025} from "./lib/ZkSyncGuardianCompensation2024_2025.sol";
import {ZkSyncGuardianCompensation2025_2026} from "./lib/ZkSyncGuardianCompensation2025_2026.sol";
import {ZkSyncGuardianCompensationSepolia2024_2025} from "./lib/ZkSyncGuardianCompensationSepolia2024_2025.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 {IZkCappedMinterV2} from "../src/interfaces/zk-governance/IZkCappedMinterV2.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 CreateSafeTxScript is SafeTxHelper, Script {
/// @dev For running from `forge script`. Provide the deployer private key through env var.
function run() public virtual {
IGnosisSafe safe;
ZkSyncGuardianCompensation2024_2025.Config memory config;

// zkSync Era (zkSync Guardians)
config = ZkSyncGuardianCompensation2024_2025.getDefault(vm);
safe = config.guardianSafe;
GnosisTransaction[] memory safeTxs = new GnosisTransaction[](7);
safeTxs[0] = GnosisTransaction({
to: address(config.registry),
value: 0 ether,
data: abi.encodeWithSelector(
CyberAgreementRegistry.createTemplate.selector,
vm.envUint("BORG_RESOLUTION_TEMPLATE_ID"), // template ID
vm.envString("BORG_RESOLUTION_TEMPLATE_NAME"), // template name
vm.envString("BORG_RESOLUTION_URI"), // agreement URI
config.borgResolutionGlobalFields,
config.borgResolutionPartyFields
)
});
for (uint i = 0; i < 6 ; i++) {
safeTxs[i + 1] = GnosisTransaction({
to: address(config.registry),
value: 0 ether,
data: abi.encodeWithSelector(
CyberAgreementRegistry.createTemplate.selector,
vm.envUint(string(abi.encodePacked("GUARDIAN_TEMPLATE_ID_", vm.toString(i)))), // template ID
vm.envString(string(abi.encodePacked("GUARDIAN_TEMPLATE_NAME_", vm.toString(i)))), // template name
vm.envString(string(abi.encodePacked("GUARDIAN_AGREEMENT_URI_", vm.toString(i)))), // agreement URI
config.compGlobalFields,
config.compPartyFields
)
});
}

// zkSync Sepolia
// config = ZkSyncGuardianCompensationSepolia2024_2025.getDefault(vm);
// safe = config.guardianSafe;
// GnosisTransaction[] memory safeTxs = new GnosisTransaction[](2);
// safeTxs[0] = GnosisTransaction({
// to: address(config.registry),
// value: 0 ether,
// data: abi.encodeWithSelector(
// CyberAgreementRegistry.createTemplate.selector,
// config.compTemplateId,
// config.compTemplateName,
// config.compAgreementUri,
// config.compGlobalFields,
// config.compPartyFields
// )
// });
// safeTxs[1] = GnosisTransaction({
// to: address(config.registry),
// value: 0 ether,
// data: abi.encodeWithSelector(
// CyberAgreementRegistry.createTemplate.selector,
// config.serviceTemplateId,
// config.serviceTemplateName,
// config.serviceAgreementUri,
// config.serviceGlobalFields,
// config.servicePartyFields
// )
// });

// Output logs

console2.log("");
console2.log("=== CreateSafeTxScript ===");
console2.log("Safe: ", address(safe));
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("");
}
}
}
87 changes: 87 additions & 0 deletions scripts/deployTestZkCappedMinter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.24;

import {ZkSyncGuardianCompensation2024_2025} from "./lib/ZkSyncGuardianCompensation2024_2025.sol";
import {ZkSyncGuardianCompensationSepolia2024_2025} from "./lib/ZkSyncGuardianCompensationSepolia2024_2025.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 {ZkCappedMinterV2} from "zk-governance/l2-contracts/src/ZkCappedMinterV2.sol";
import {IZkCappedMinterV2Factory} from "../src/interfaces/zk-governance/IZkCappedMinterV2Factory.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 DeployTestZkCappedMinterScript is SafeTxHelper, Script {
/// @dev For running from `forge script`. Provide the deployer private key through env var.
function run() public virtual {
run(
vm.envUint("DEPLOYER_PRIVATE_KEY"),

// zkSync Sepolia for 2024-2025
"MetaLexMetaVestZkSyncGuardianCompensationTestnetV0.1.2024-2025",
IZkCappedMinterV2Factory(0x329CE320a0Ef03F8c0E01195604b5ef7D3Fb150E),
ZkSyncGuardianCompensationSepolia2024_2025.getDefault(vm)

// zkSync Sepolia for 2025-2026
// "MetaLexMetaVestZkSyncGuardianCompensationTestnetV0.1.2025-2026",
// IZkCappedMinterV2Factory(0x329CE320a0Ef03F8c0E01195604b5ef7D3Fb150E),
// ZkSyncGuardianCompensationSepolia2025_2026.getDefault(vm)
);
}

/// @dev For running in tests
function run(
uint256 deployerPrivateKey,
string memory saltStr,
IZkCappedMinterV2Factory zkCappedMinterFactory,
ZkSyncGuardianCompensation2024_2025.Config memory config
) public virtual returns(
address
) {
address deployer = vm.addr(deployerPrivateKey);

uint256 startTime = block.timestamp + 5 minutes;

console2.log("");
console2.log("=== DeployTestZkCappedMinterScript ===");
console2.log("Deployer: ", deployer);
console2.log("Salt string: ", saltStr);
console2.log("Start time: ", startTime);
console2.log("ZK Token: ", address(config.zkToken));
console2.log("Guardian SAFE: ", address(config.guardianSafe));
console2.log("");

bytes32 salt = keccak256(bytes(saltStr));

vm.startBroadcast(deployerPrivateKey);

// Deploy MetaVesT Controller

ZkCappedMinterV2 zkCappedMinter = ZkCappedMinterV2(zkCappedMinterFactory.createCappedMinter(
address(config.zkToken),
address(config.guardianSafe),
8.5e6 ether,
uint48(startTime),
uint48(startTime + 365 days * 2),
uint256(salt)
));

// Grant capped minter permission

config.zkToken.grantRole(config.zkToken.MINTER_ROLE(), address(zkCappedMinter));

vm.stopBroadcast();

// Output logs

console2.log("Deployed addresses:");
console2.log(" ZK Capped Minter v2: ", address(zkCappedMinter));
console2.log("");

return address(zkCappedMinter);
}
}
Loading