The Metabased Sequencer Chain is a modular protocol for sequencing transactions in Layer 3 chains. It uses a flexible system of modules to determine who is allowed to sequence transactions.
- MetabasedSequencerChain: The core contract for sequencing transactions.
- RequireListManager: Manages the list of modules that determine sequencing permissions.
- Modules: Implement the
IsAllowed
interface to define custom sequencing criteria.
The easiest way to get started is using VS Code's Dev Containers. This approach provides a consistent development environment with all required dependencies pre-installed.
- Install VS Code
- Install Docker Desktop
- Install the Dev Containers extension in VS Code
-
Clone the repository:
git clone https://github.com/SyndicateProtocol/metabased-sequencer-chain-sc-modules-workshop.git cd metabased-sequencer-chain-sc-modules-workshop
-
Open the project in VS Code:
code .
-
When prompted "Reopen in Container", click "Reopen in Container". Alternatively:
- Press
F1
orCmd/Ctrl + Shift + P
- Type "Dev Containers: Reopen in Container"
- Press Enter
- Press
-
Wait for the container to build. This might take a few minutes the first time.
Once inside the dev container, open a terminal in VS Code (Ctrl +
` or View -> Terminal) and run:
# Verify Foundry installation
forge --version
# Build the project
forge build
- The container comes with Foundry and all required dependencies pre-installed
- Your local files are mounted in the container, so any changes you make are preserved
- VS Code extensions for Solidity development are automatically installed
- You can use the integrated terminal in VS Code to run commands
-
If the container fails to build:
# In VS Code: 1. Command Palette (Cmd/Ctrl + Shift + P) 2. "Dev Containers: Rebuild Container"
-
If Foundry commands aren't working:
foundryup
-
If you need to reset everything:
# Close VS Code # Delete the .devcontainer folder # Reopen VS Code and rebuild the container
-
If you see permission issues:
- Make sure Docker Desktop is running
- Try running Docker Desktop with administrator privileges
-
Create a new Solidity file in the
src/modules
directory. -
Implement the
IsAllowed
interface:import {IsAllowed} from "src/interfaces/IsAllowed.sol"; contract YourNewModule is IsAllowed { function isAllowed(address proposer) external view override returns (bool) { // Your logic here } }
-
Implement your custom logic in the
isAllowed
function.
-
Build the module:
forge build
-
Deploy the module (replace
YourNewModule
with your contract name): -
Copy and script file to the
scripts
directory. Use one of the existing scripts as a template. -
add a command to the
Makefile
to run your script. Use the section below as example.
In the workshop, we will use a fork of Metabased Testnet so you don't need to have ETH to deploy the contracts. The deployment scripts can be found /script
folder.
Forking the Metabased Testnet:
make fork-metabased-testnet
Running the script in fork mode
make fork-allowlist-module-deploy-and-run
-
Install Docker Desktop:
-
Install Git:
-
Clone the repository:
git clone https://github.com/SyndicateProtocol/metabased-sequencer-chain-sc-modules-workshop.git cd metabased-sequencer-chain-sc-modules-workshop
-
Build and start the container:
docker compose up -d
-
Enter the container:
docker compose exec metabased-dev bash
-
Verify the installation:
# Inside the container forge --version cast --version anvil --version
-
copy
.env.example
to.env
and fill in the required values.
cp .env.example .env
# Exit the container first (if you're in it)
exit
# Then restart
docker compose down
docker compose up -d
To stop the container:
docker compose down
To stop and remove all associated volumes:
docker compose down -v
-
If you get permission errors:
# On Linux/Mac, you might need to run sudo chown -R $USER:$USER .
-
If the build fails:
# Clean and rebuild docker compose down -v docker compose build --no-cache docker compose up -d
-
If Foundry commands aren't working:
# Inside the container foundryup
- Git
- Foundry
-
Clone the repository:
git clone https://github.com/SyndicateProtocol/metabased-sequencer-chain-sc-modules-workshop.git cd metabased-sequencer-chain-sc-modules-workshop
-
Install dependencies:
forge install
-
Build the project:
forge build
-
copy
.env.example
to.env
and fill in the required values.
cp .env.example .env