Skip to content

Commit

Permalink
Refactor scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AllFi committed Jun 19, 2024
1 parent f2dfdcd commit 4514d20
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

pragma solidity 0.8.15;

import {ZkBobPool} from "../../../src/zkbob/ZkBobPoolUSDC.sol";
import {IZkBobAccounting, IKycProvidersManager, ZkBobAccounting} from "../../../src/zkbob/utils/ZkBobAccounting.sol";
import {EIP1967Proxy} from "../../../src/proxy/EIP1967Proxy.sol";
import {console, Script} from "forge-std/Script.sol";
import {ZkBobPool, ZkBobPoolUSDC} from "../../src/zkbob/ZkBobPoolUSDC.sol";
import {IZkBobAccounting, IKycProvidersManager, ZkBobAccounting} from "../../src/zkbob/utils/ZkBobAccounting.sol";
import {EIP1967Proxy} from "../../src/proxy/EIP1967Proxy.sol";

contract AccountingMigrator {
constructor() {}
Expand Down Expand Up @@ -53,3 +54,13 @@ contract AccountingMigrator {
}
}
}

contract DeployAccountingMigrator is Script {
function run() external {
vm.startBroadcast();
AccountingMigrator migrator = new AccountingMigrator();
vm.stopBroadcast();

console.log("AccountingMigrator: ", address(migrator));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {console, Script} from "forge-std/Script.sol";
import {ZkBobPoolUSDC} from "../../src/zkbob/ZkBobPoolUSDC.sol";
import {ZkBobAccounting} from "../../src/zkbob/utils/ZkBobAccounting.sol";
import {EIP1967Proxy} from "../../src/proxy/EIP1967Proxy.sol";
import {AccountingMigrator} from "./helpers/AccountingMigrator.sol";

/**
* @dev OP-USDC pool proxy address.
Expand All @@ -21,7 +20,7 @@ address constant zkBobTimelock = 0xbe7D4E55D80fC3e67D80ebf988eB0E551cCA4eB7;
/**
* @dev Don't forget to set ZkBobPool.TOKEN_NUMERATOR to 1000 for USDC pools.
*/
contract PreMigrateAccounting is Script {
contract DeployZkBobPoolImplAndAccounting is Script {
function run() external {
ZkBobPoolUSDC pool = ZkBobPoolUSDC(address(zkBobPool));

Expand All @@ -43,15 +42,11 @@ contract PreMigrateAccounting is Script {
// 3. Set timelock as the owner of the accounting
accounting.transferOwnership(zkBobTimelock);

// 4. Deploy one-time Migrator
AccountingMigrator migrator = new AccountingMigrator();

vm.stopBroadcast();

assert(accounting.owner() == zkBobTimelock);

console.log("ZkBobPool implementation:", address(newImpl));
console.log("ZkBobAccounting: ", address(accounting));
console.log("AccountingMigrator: ", address(migrator));
}
}
2 changes: 1 addition & 1 deletion script/scripts/MigrateAccounting.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {Test} from "forge-std/Test.sol";
import {ZkBobPool, ZkBobPoolUSDC} from "../../src/zkbob/ZkBobPoolUSDC.sol";
import {IZkBobAccounting, IKycProvidersManager, ZkBobAccounting} from "../../src/zkbob/utils/ZkBobAccounting.sol";
import {EIP1967Proxy} from "../../src/proxy/EIP1967Proxy.sol";
import {AccountingMigrator} from "./helpers/AccountingMigrator.sol";
import {AccountingMigrator} from "./DeployAccountingMigrator.s.sol";

// WARN: Update this values before running the script
address constant newZkBobPoolImpl = 0xD217AEf4aB37F7CeE7462d25cbD91f46c1E688a9;
Expand Down

0 comments on commit 4514d20

Please sign in to comment.