Skip to content

Conversation

@waelsy123
Copy link
Contributor

@waelsy123 waelsy123 commented Nov 6, 2025

Motivation:

We don't want to give the owner always full power with all master vault functionalities. so I'm introducing access control roles, with that requests doesn't have to always go thought the factory contract like setSubvault therefore we dropped this call.

changes:

  1. add access control upgradable extension and define 4 roles
  2. make the master vault pausable
  3. remove setSubvault from factory contract

@cla-bot cla-bot bot added the cla-signed label Nov 6, 2025
@waelsy123 waelsy123 force-pushed the feat/access-control branch from fdd512f to f7c492d Compare November 6, 2025 14:13
@waelsy123 waelsy123 requested a review from Copilot November 6, 2025 21:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces role-based access control to the MasterVault system, replacing the previous owner-centric model with granular permissions for vault management, fee management, and pausing operations. The changes enable more flexible delegation of responsibilities without requiring all operations to go through the factory contract.

Key changes:

  • Replaces OwnableUpgradeable with AccessControlUpgradeable and defines four roles: DEFAULT_ADMIN_ROLE, VAULT_MANAGER_ROLE, FEE_MANAGER_ROLE, and PAUSER_ROLE
  • Adds pausability to the MasterVault with pause/unpause functions restricted to PAUSER_ROLE
  • Removes setSubVault method from factory contract, allowing direct vault management by role holders

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
contracts/tokenbridge/libraries/vault/MasterVault.sol Implements AccessControl and Pausable, updates modifiers from onlyOwner to role-based checks, adds pause/unpause functions, fixes maxMint edge case
contracts/tokenbridge/libraries/vault/MasterVaultFactory.sol Removes setSubVault method, changes vault initialization to grant roles to owner instead of transferring ownership
contracts/tokenbridge/libraries/vault/IMasterVaultFactory.sol Removes setSubVault function and SubVaultSet event from interface
test-foundry/libraries/vault/MasterVault.t.sol Adds comprehensive tests for role-based access control and pause functionality
test-foundry/libraries/vault/MasterVaultFactory.t.sol Updates tests to verify role grants instead of ownership

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@godzillaba godzillaba left a comment

Choose a reason for hiding this comment

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

lgtm, just a couple minor comments

@godzillaba godzillaba merged commit cd1a25d into wa/master-vault-isolated Nov 7, 2025
6 of 9 checks passed
@godzillaba godzillaba deleted the feat/access-control branch November 7, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants