rhinestone

Introduction

Getting started

The fastest way to start building a smart account module is by using ModuleKit, a development kit for building and testing modules. This guide will walk you through installing ModuleKit and setting yourself up to start building innovative modules.

ModuleKit is based on 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

Installation

  1. Install ModuleKit by using our template or adding it into an existing foundry project:

Installation

git clone https://github.com/rhinestonewtf/module-template.git
cd module-template
forge install

Building a module

The ModuleKit makes building a module a straightforward process. Simply create a new contract in src/[MODULE_TYPE] and inherit from the correct interface for that module type. Learn more about module types and their interfaces here. Apart from that, the only thing you need to do is adhere to the interface by implementing all required functions and, if building a validator, adhere to the additional requirements. For hands-on guides to building modules, visit the tutorials section of the docs.

Testing a module

The ModuleKit provides an end-to-end testing framework to make it easy for you to test your modules and abstract away all the complexities. To start testing a module simply create a .t.sol file under test/[MODULE_TYPE] and inherit from the right RhinestoneModuleKit library depending on which account you want to test your Module against, as well as Foundry's Test. Now you can use the provided tools in order to simplify and accelerate the testing of your module. For hands-on guides to testing modules, visit the tutorials section of the docs.

Deploying a module

The ModuleKit allows you to easily deploy and register your Module on the Module Registry. To do so, simply create a script in the script/ folder and inherit from the provided RegistryDeployer library. Learn more about deploying and registering modules here. For hands-on guides to deploying modules, visit the deployment tutorial.