How Module Instances Are Deployed
Last updated
Last updated
All contracts that inherit from can be deployed as minimal proxy clones via , which offers several operations:
create a single module instance
batch create multiple module instances
predict the address of a module instance
check if a module instance has already been deployed
Each of these functions can be called directly on the HatsModuleFactory contract, or they can be accessed via the to easily deploy new module instances and more.
The function deploys a new proxy instance, for the provided implementation, to a deterministic address. The instance's immutable arguments are set its creation, and then instance.setUp
is called with the provided initialization data.
Parameters:
_implementation
- The address of the implementation contract for which to deploy a clone.
_hatId
- The hat for which to deploy the module.
_otherImmutableArgs
: Immutable arguments to pass to the clone, packed encoded (via abi.encodePacked
). These are additional to the ones .
_initData
- Encoded data (via abi.encode) to pass to the setUp
function of the new instance.
Returns:
_instance
- The new instance's address.
Events:
Once the new module deployment and setup have completed, the function will emit the following event, which contains the new instance address:
The necessary creation parameters are passed as arrays, which must have the same length, equal to the number of modules to be created. For each module, the createHatsModule
function will be called with the arrays entries, on the same corresponding index.
Parameters:
_implementations
- The addresses of the implementation contracts for which to deploy a clone.
_hatIds
- The hats for which to deploy the modules.
_initDataArray
- Encoded data (via abi.encode) to pass to the setUp
function of each new module instance.
Returns:
success
- True
if all modules were successfully created and initialized, false
otherwise.
Events:
For every successfully created module, the function will emit the following event, which contains the new instance address:
Parameters:
_implementation
- The address of the implementation contract.
_hatId
- The hat for which to deploy a module.
Returns:
The predicted instance address.
Parameters:
_implementation
- The address of the implementation contract.
_hatId
- The hat for which to deploy a module.
Returns:
True
if the instance has been deployed, false
otherwise.
It is known to have been deployed to the following networks:
The function creates multiple instances, using the function.
_otherImmutableArgsArray
: Immutable argumentss to pass to the clones, packed encoded (via abi.encodePacked
). These are additional to the ones .
The function predicts the address of a module instance before it was created.
_otherImmutableArgs
: Immutable arguments to pass to the clone, packed encoded (via abi.encodePacked
). These are additional to the ones .
The function checks if a certain module instance has been deployed.
_otherImmutableArgs
: Immutable arguments to pass to the clone, packed encoded (via abi.encodePacked
). These are additional to the ones .
HatsModuleFactory is deployed to the same address on all networks: 0xfE661c01891172046feE16D3a57c3Cf456729efA