This tutorial will walk you through deploying any of your modules. Simultaneously, this will also register your module on the Module Registry in order to make it available to users.
This tutorial uses Foundry, a toolchain to simplify and speed up smart contract development. If you are not familiar with Foundry, feel free to check out their docs.
If you do not have foundry installed, run the following command and follow the onscreen instructions:
bash curl -L https://foundry.paradigm.xyz | bash
- Get started with ModuleKit by using our template or adding it into an existing foundry project:
git clone https://github.com/rhinestonewtf/module-template.git cd module-template forge install
In this section, we will deploy the module.
- Open the file
script/DeployModule.s.soland change the following code:
bytes memory bytecode = type(ValidatorTemplate).creationCode; bytes memory deployParams = ""; bytes memory data = "";
ValidatorTemplate to the name of your module and
deployParams to the parameters you want to pass to the constructor (if any). Finally, change
data to the data you want to be stored additionally on the Registry (you will likely want to leave this empty for now).
- Create a
.envfile in the root directory and add the following variables:
- Replace the following variables in the command below and then run it in your terminal:
RPC_URLis the URL of the RPC node you want to use to broadcast the transaction.
SENDER_ADDRESSis the address of the account you want to use to deploy the module (the address of the private key you added to your
.envfile). Hint: use
cast wallet address --private-key [YOUR_PRIVATE_KEY]to get the address of your private key in your command line.
forge script script/DeployModule.s.sol:DeployModuleScript --rpc-url [RPC_URL] --sender [SENDER_ADDRESS] --broadcast
- If you scroll up to the top of your command, you should see the following message:
== Logs == Module deployed at: 0x...