Skip to content

Commit

Permalink
refactor meta factory
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrockrises committed May 20, 2024
1 parent 25e167a commit 92ebf11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions contracts/factory/BiconomyMetaFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,23 @@ contract BiconomyMetaFactory is Stakeable {
constructor(address owner) Stakeable(owner) {
}

// could be IAccountFactory
// whitelist / blacklist a factory
function whitelistFactory(address factory, bool whitelisted) external payable onlyOwner {
factoryWhitelist[factory] = whitelisted;
/// @notice Adds an address to the factory whitelist.
/// @param factory The address to be whitelisted.
function addFactoryToWhitelist(address factory) external onlyOwner {
factoryWhitelist[factory] = true;
}

/// @notice Removes an address from the factory whitelist.
/// @param factory The address to be removed from the whitelist.
function removeFactoryFromWhitelist(address factory) external onlyOwner {
factoryWhitelist[factory] = false;
}


/// @notice Checks if an address is whitelisted.
/// @param factory The address to check.
function isWhitelisted(address factory) public view returns (bool) {
return factoryWhitelist[factory];
}

// removeFactoryFromWhitelist
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/utils/Helpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ contract Helpers is CheatCodes, EventsAndErrors, BootstrapUtil {
FACTORY = new AccountFactoryGeneric(address(ACCOUNT_IMPLEMENTATION), address(FACTORY_OWNER.addr));
META_FACTORY = new BiconomyMetaFactory(address(FACTORY_OWNER.addr));
vm.prank(FACTORY_OWNER.addr);
META_FACTORY.whitelistFactory(address(FACTORY), true);
META_FACTORY.addFactoryToWhitelist(address(FACTORY));
VALIDATOR_MODULE = new MockValidator();
EXECUTOR_MODULE = new MockExecutor();
HOOK_MODULE = new MockHook();
Expand Down

0 comments on commit 92ebf11

Please sign in to comment.