From 38ca388425476d28f493bafaa7e3936dc7b7d701 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Thu, 18 Apr 2024 10:33:18 -0400 Subject: [PATCH] chore: reorg inits, add multicall auth test --- contracts/PointTokenVault.sol | 2 +- contracts/test/PointTokenVault.t.sol | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/contracts/PointTokenVault.sol b/contracts/PointTokenVault.sol index 2ac2b68..b3b2529 100644 --- a/contracts/PointTokenVault.sol +++ b/contracts/PointTokenVault.sol @@ -69,9 +69,9 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall } function initialize() public initializer { - __Multicall_init(); __UUPSUpgradeable_init(); __AccessControl_init(); + __Multicall_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); } diff --git a/contracts/test/PointTokenVault.t.sol b/contracts/test/PointTokenVault.t.sol index d15cdab..176a00e 100644 --- a/contracts/test/PointTokenVault.t.sol +++ b/contracts/test/PointTokenVault.t.sol @@ -275,6 +275,23 @@ contract PointTokenVaultTest is Test { assertEq(pointTokenVault.pointTokens(eigenPointsId).balanceOf(toly), 0.5e18); } + function test_MulticallAuth(address lad) public { + vm.assume(lad != admin); + // Only admin can exec + vm.expectRevert( + abi.encodeWithSelector( + IAccessControl.AccessControlUnauthorizedAccount.selector, lad, pointTokenVault.MERKLE_UPDATER_ROLE() + ) + ); + vm.prank(lad); + bytes[] memory calls = new bytes[](1); + calls[0] = abi.encodeCall(pointTokenVault.updateRoot, (bytes32("123"))); + pointTokenVault.multicall(calls); + + vm.prank(merkleUpdater); + pointTokenVault.multicall(calls); + } + function test_SimpleRedemption() public { bytes32 root = 0x4e40a10ce33f33a4786960a8bb843fe0e170b651acd83da27abc97176c4bed3c;