Skip to content

Commit

Permalink
#24 Update RegistryFactory constructor to validate threshold against …
Browse files Browse the repository at this point in the history
…attesters length
  • Loading branch information
Aboudjem committed Aug 15, 2024
1 parent 6f86af4 commit 0747d3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contracts/factory/RegistryFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ contract RegistryFactory is Stakeable, INexusFactory {
/// @param module The module address that is not whitelisted.
error ModuleNotWhitelisted(address module);

/// @notice Error thrown when the threshold exceeds the number of attesters.
/// @param threshold The provided threshold value.
/// @param attestersLength The number of attesters provided.
error InvalidThreshold(uint8 threshold, uint256 attestersLength);

/// @notice Constructor to set the smart account implementation address and owner.
/// @param implementation_ The address of the Nexus implementation to be used for all deployments.
/// @param owner_ The address of the owner of the factory.
constructor(address implementation_, address owner_, IERC7484 registry_, address[] memory attesters_, uint8 threshold_) Stakeable(owner_) {
require(implementation_ != address(0), ImplementationAddressCanNotBeZero());
require(owner_ != address(0), ZeroAddressNotAllowed());
require(threshold_ <= attesters_.length, InvalidThreshold(threshold_, attesters_.length));
REGISTRY = registry_;
attesters = attesters_;
threshold = threshold_;
Expand Down

0 comments on commit 0747d3d

Please sign in to comment.