Skip to content

feat(revenue): add batchAccrueVaultFees to RevenueCollector - #223

Open
razww wants to merge 1 commit into
masterfrom
feature/revenue-collector-update-vault-fees
Open

feat(revenue): add batchAccrueVaultFees to RevenueCollector#223
razww wants to merge 1 commit into
masterfrom
feature/revenue-collector-update-vault-fees

Conversation

@razww

@razww razww commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a BOT-gated way for the RevenueCollector to trigger fee accrual on Moolah vaults via a zero-asset deposit(0, address(this)) call. A zero-asset deposit mints no shares but runs the vault's _accrueFee() logic, realizing accrued fees to the vault's fee recipient.

Changes

  • batchAccrueVaultFees(address[] calldata vaults) — validates 0 < length <= MAX_LENGTH (30) and accrues each vault.
  • accrueVaultFee(address vault) — single-vault variant.
  • _accrueVaultFee internal helper + VaultFeeAccrued(address indexed vault) event.
  • Both external methods are onlyRole(BOT), consistent with the existing DEX/liquidation fee methods.

Notes

  • deposit(0, ...) in MoolahVault gates the receiver on the vault whitelist (when non-empty). Since the receiver is address(this), the RevenueCollector address must be whitelisted on any vault that enforces a whitelist. Shareholding is irrelevant.
  • Zero-amount paths are safe: _supplyMoolah(0) is a no-op and _mint(receiver, 0) does not revert.

Testing

  • forge test --mc RevenueCollectorTest — 8 passed (3 new: test_batchAccrueVaultFees, test_accrueVaultFee, test_batchAccrueVaultFees_invalidLength).
  • forge build clean; prettier passes.

🤖 Generated with Claude Code

Add BOT-gated batchAccrueVaultFees/accrueVaultFee methods that trigger
Moolah vault fee accrual via a zero-asset deposit(0, address(this)).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hashdit-bot

hashdit-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

Pull Request Review

This Solidity PR adds BOT-gated single and batch functions to trigger Moolah vault fee accrual through zero-asset deposits, along with a corresponding event and internal helper. It also adds Foundry tests covering role enforcement, successful calls, receiver and amount parameters, and batch-length validation.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

@qingyang-lista qingyang-lista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lawson-ccy lawson-ccy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants