@@ -6,8 +6,10 @@ import "forge-std/console.sol";
66
77import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol " ;
88import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol " ;
9+ import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol " ;
910
1011import "../../contracts/dao/ClisBNBLaunchPoolDistributor.sol " ;
12+ import "../../contracts/utils/BatchManagementUtils.sol " ;
1113
1214contract ClisBNBLaunchPoolDistributorTest is Test {
1315
@@ -20,6 +22,7 @@ contract ClisBNBLaunchPoolDistributorTest is Test {
2022 address operator;
2123
2224 ClisBNBLaunchPoolDistributor cliBNBLaunchPoolDistributor;
25+ BatchManagementUtils batchManagementUtils;
2326
2427 uint256 mainnet;
2528
@@ -73,9 +76,28 @@ contract ClisBNBLaunchPoolDistributorTest is Test {
7376
7477 cliBNBLaunchPoolDistributor = ClisBNBLaunchPoolDistributor (payable (address (clisBNBLPDistributorProxy)));
7578
79+ BatchManagementUtils batchUtilsImpl = new BatchManagementUtils ();
80+ ERC1967Proxy batchUtilsProxy = new ERC1967Proxy (
81+ address (batchUtilsImpl),
82+ abi.encodeWithSelector (
83+ batchManagementUtils.initialize.selector ,
84+ admin,
85+ manager
86+ )
87+ );
88+ batchManagementUtils = BatchManagementUtils (address (batchUtilsProxy));
89+
90+ vm.startPrank (manager);
91+ batchManagementUtils.setDistributor (address (cliBNBLaunchPoolDistributor), true );
92+ vm.stopPrank ();
93+
7694 vm.startPrank (admin);
7795 cliBNBLaunchPoolDistributor.grantRole (cliBNBLaunchPoolDistributor.OPERATOR (), operator);
96+ cliBNBLaunchPoolDistributor.grantRole (cliBNBLaunchPoolDistributor.OPERATOR (), address (batchManagementUtils));
7897 vm.stopPrank ();
98+
99+
100+
79101 }
80102
81103 function test_setUp () public {
@@ -264,4 +286,33 @@ contract ClisBNBLaunchPoolDistributorTest is Test {
264286 vm.expectRevert ("User already claimed " );
265287 cliBNBLaunchPoolDistributor.claim (0 , 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2 , 123e18 , proof);
266288 }
289+
290+ function test_batch_setEpochMerkleRoot_ok () public {
291+ uint64 [] memory epochIds = new uint64 [](1 );
292+ epochIds[0 ] = 0 ;
293+ ClisBNBLaunchPoolDistributor.Epoch[] memory before = cliBNBLaunchPoolDistributor.getEpochs (epochIds);
294+ assertEq (0 , before[0 ].startTime);
295+
296+ BatchManagementUtils.MerkleRootInfo[] memory infos = new BatchManagementUtils.MerkleRootInfo [](1 );
297+ infos[0 ] = BatchManagementUtils.MerkleRootInfo ({
298+ distributor: address (cliBNBLaunchPoolDistributor),
299+ epochId: 0 ,
300+ merkleRoot: root,
301+ token: address (lista),
302+ startTime: block .timestamp + 10 ,
303+ endTime: block .timestamp + 1000 ,
304+ totalAmount: 1737e18
305+ });
306+
307+ vm.startPrank (operator);
308+ batchManagementUtils.batchSetEpochMerkleRoot (infos);
309+ vm.stopPrank ();
310+
311+ ClisBNBLaunchPoolDistributor.Epoch[] memory actual = cliBNBLaunchPoolDistributor.getEpochs (epochIds);
312+ assertEq (root, actual[0 ].merkleRoot);
313+ assertEq (address (lista), actual[0 ].token);
314+ assertEq (block .timestamp + 10 , actual[0 ].startTime);
315+ assertEq (block .timestamp + 1000 , actual[0 ].endTime);
316+ assertEq (1737e18 , actual[0 ].totalAmount);
317+ }
267318}
0 commit comments