Skip to content

Commit

Permalink
feat: deployed migrator
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill-fedoseev committed Jul 1, 2024
1 parent 4514d20 commit f97e698
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
19 changes: 3 additions & 16 deletions script/scripts/DeployAccountingMigrator.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@ import {EIP1967Proxy} from "../../src/proxy/EIP1967Proxy.sol";
contract AccountingMigrator {
constructor() {}

// TODO: Check limits
function migrate(
address _pool,
address _accounting,
address _kycManager,
address _accountingOwner,
address _proxyAdmin
)
external
{
function migrate(address _pool, address _accounting, address _accountingOwner, address _proxyAdmin) external {
ZkBobAccounting accounting = ZkBobAccounting(_accounting);

bytes memory dump = ZkBobPool(_pool).extsload(bytes32(uint256(1)), 2);
Expand All @@ -33,15 +24,11 @@ contract AccountingMigrator {
ZkBobPool(_pool).setAccounting(IZkBobAccounting(accounting));

accounting.initialize(txCount, tvl, cumTvl, maxWeeklyTxCount, maxWeeklyAvgTvl);
accounting.setKycProvidersManager(IKycProvidersManager(_kycManager));
accounting.setLimits(
0, 2_000_000 gwei, 300_000 gwei, 300_000 gwei, 10_000 gwei, 10_000 gwei, 10_000 gwei, 1_000 gwei
0, 10_000_000 gwei, 300_000 gwei, 300_000 gwei, 10_000 gwei, 10_000 gwei, 10_000 gwei, 1_000 gwei
);
accounting.setLimits(
1, 2_000_000 gwei, 300_000 gwei, 300_000 gwei, 100_000 gwei, 100_000 gwei, 10_000 gwei, 1_000 gwei
);
accounting.setLimits(
254, 2_000_000 gwei, 300_000 gwei, 300_000 gwei, 20_000 gwei, 20_000 gwei, 10_000 gwei, 1_000 gwei
1, 10_000_000 gwei, 300_000 gwei, 300_000 gwei, 100_000 gwei, 100_000 gwei, 10_000 gwei, 1_000 gwei
);

accounting.transferOwnership(_accountingOwner);
Expand Down
10 changes: 5 additions & 5 deletions script/scripts/MigrateAccounting.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {EIP1967Proxy} from "../../src/proxy/EIP1967Proxy.sol";
import {AccountingMigrator} from "./DeployAccountingMigrator.s.sol";

// WARN: Update this values before running the script
address constant newZkBobPoolImpl = 0xD217AEf4aB37F7CeE7462d25cbD91f46c1E688a9;
address constant zkBobAccounting = 0xFd5a6a67D768d5BF1A8c7724387CA8786Bd4DD91;
address constant accountingMigrator = 0x0114Bf30d9f5A7f503D3DFC65534F2B5AC302c85;
address constant newZkBobPoolImpl = 0x84605eA206A1d5b39f13dC7add690dbD1e038525;
address constant zkBobAccounting = 0xbF3D58f026642951990C0421964179C83E2c9C1B;
address constant accountingMigrator = 0xbfF0020638011357315302727eD55C5193a95F7b;
address constant accountingOwner = 0x14fc6a1a996A2EB889cF86e5c8cD17323bC85290;

/**
Expand Down Expand Up @@ -105,15 +105,15 @@ contract MigrateAccounting is Script, UpgradeTest {
AccountingMigrator migrator = AccountingMigrator(accountingMigrator);
PoolSnapshot memory snapshot = makeSnapshot(pool);

vm.startBroadcast();
vm.startBroadcast(snapshot.proxyAdmin);

EIP1967Proxy(payable(address(pool))).upgradeTo(address(newZkBobPoolImpl));

EIP1967Proxy(payable(address(pool))).setAdmin(accountingMigrator);

ZkBobAccounting(zkBobAccounting).transferOwnership(accountingMigrator);

migrator.migrate(address(pool), zkBobAccounting, snapshot.kycManager, accountingOwner, snapshot.proxyAdmin);
migrator.migrate(address(pool), zkBobAccounting, accountingOwner, snapshot.proxyAdmin);

vm.stopBroadcast();

Expand Down

0 comments on commit f97e698

Please sign in to comment.