Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AllFi committed Feb 26, 2024
1 parent e3da183 commit 0333691
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions script/scripts/DeployZkBobPoolModules.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ contract Migrator {
ZkBobPool(_target).setMinTreeUpdateFee(minTreeUpdateFee);
ZkBobPoolUSDC(_target).setTokenSeller(_tokenSeller);

// TODO: why are we using txCount + 1?
ZkBobAccounting(_accounting).initialize(txCount + 1, tvl, cumTvl, maxWeeklyTxCount, maxWeeklyAvgTvl);
ZkBobAccounting(_accounting).initialize(txCount, tvl, cumTvl, maxWeeklyTxCount, maxWeeklyAvgTvl);
ZkBobAccounting(_accounting).setKycProvidersManager(IKycProvidersManager(kycManager));
ZkBobAccounting(_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
Expand All @@ -57,6 +56,10 @@ contract Migrator {
}
}

/**
* @dev This script assumes that pool.owner == proxyAdmin
* @dev This script uses gracePeriod and minTreeUpdateFee from Env.s.sol
*/
contract DeployZkBobPoolModules is Script, Test {
function run() external {
runWithPoolAddress(address(zkBobPool), true);
Expand Down
8 changes: 5 additions & 3 deletions test/scripts/DeployZkBobPoolModules.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ contract DeployZkBobPoolModulesTest is AbstractOptimismForkTest {

DeployZkBobPoolModules upgrade = new DeployZkBobPoolModules();

// It seems that DeployZkBobPoolModules assumes that proxyAdmin is the owner of the pool
// TODO: confirm it
// DeployZkBobPoolModules assumes that proxyAdmin is the owner of the pool
address proxyAdmin = EIP1967Proxy(payable(address(pool))).admin();
address owner = pool.owner();
vm.prank(owner);
Expand All @@ -54,7 +53,7 @@ contract DeployZkBobPoolModulesTest is AbstractOptimismForkTest {
vm.stopPrank();

assertEq(poolState.owner, pool.owner());
assertEq(address(pool.redeemer()), address(0)); // TODO: energy redeemer will not be set by script
assertEq(address(pool.redeemer()), address(0)); // redeemer is not set by script
assertNotEq(address(pool.accounting()), address(0));
assertEq(poolState.poolIndex, uint256(pool.pool_index()));
assertEq(poolState.operatorManager, address(pool.operatorManager()));
Expand All @@ -70,6 +69,9 @@ contract DeployZkBobPoolModulesTest is AbstractOptimismForkTest {

checkSlot0(uint256(poolState.slot0), ZkBobAccounting(address(pool.accounting())));
checkSlot1(uint256(poolState.slot1), ZkBobAccounting(address(pool.accounting())));

vm.expectRevert("ZkBobPool: queue is empty");
pool.pendingCommitment();
}

function checkSlot0(uint256 slot0, ZkBobAccounting accounting) internal {
Expand Down

0 comments on commit 0333691

Please sign in to comment.