Skip to content

Commit

Permalink
Change claimFees to not use requiresAuth and instead specifically che…
Browse files Browse the repository at this point in the history
…ck if the caller is the boring vault
  • Loading branch information
crispymangoes committed Apr 8, 2024
1 parent 506e197 commit 6d64ee3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/base/Roles/AccountantWithRateProviders.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ contract AccountantWithRateProviders is Auth, IRateProvider {
error AccountantWithRateProviders__ManagementFeeTooLarge();
error AccountantWithRateProviders__Paused();
error AccountantWithRateProviders__ZeroFeesOwed();
error AccountantWithRateProviders__OnlyCallableByBoringVault();

//============================== EVENTS ===============================

Expand Down Expand Up @@ -275,7 +276,9 @@ contract AccountantWithRateProviders is Auth, IRateProvider {
* @notice Claim pending fees.
* @dev This function must be called by the BoringVault.
*/
function claimFees(ERC20 feeAsset) external requiresAuth {
function claimFees(ERC20 feeAsset) external {
if (msg.sender != address(vault)) revert AccountantWithRateProviders__OnlyCallableByBoringVault();

AccountantState storage state = accountantState;
if (state.isPaused) revert AccountantWithRateProviders__Paused();
if (state.feesOwedInBase == 0) revert AccountantWithRateProviders__ZeroFeesOwed();
Expand Down
6 changes: 5 additions & 1 deletion test/AccountantWithRateProviders.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,11 @@ contract AccountantWithRateProvidersTest is Test, MainnetAddresses {

address attacker = vm.addr(1);
vm.startPrank(attacker);
vm.expectRevert(bytes("UNAUTHORIZED"));
vm.expectRevert(
abi.encodeWithSelector(
AccountantWithRateProviders.AccountantWithRateProviders__OnlyCallableByBoringVault.selector
)
);
accountant.claimFees(WETH);
vm.stopPrank();

Expand Down

0 comments on commit 6d64ee3

Please sign in to comment.