Build Your Own Adapter
Time Breakdown
| Phase | Time | What You'll Do |
|---|---|---|
| 1. Learn the System | ~30 min | Understand mental model, config structure |
| 2. Study Existing Adapters | ~45 min | Find similar adapter, study code |
| 3. Implement Your Adapter | ~1-2 hours | Copy, modify, customize |
| 4. Test Locally | ~30 min | Verify CSV output, cross-check on-chain |
| 5. Deploy & Verify | ~30 min | Deploy to Railway, confirm in Absinthe |
Phase 1: Learn the System (~30 min)
Start here. Don't skip this.
Read: Getting Started
You'll learn:
- Mental model: trackables, positions vs actions
- Config structure:
config.absinthe.json - Repository layout
- Common patterns
Phase 2: Study Existing Adapters (~45 min)
Find the adapter most similar to your protocol:
| Your Protocol Type | Base Adapter | Trackables |
|---|---|---|
| Token balances | erc20-holdings | token (position) |
| AMM with fungible LP | uniswap-v2 | swap (action), lp (position) |
| AMM with NFT positions | uniswap-v3 | swap (action), lp (position) |
| Lending markets | morphomarkets | morphoblue (position) |
| ERC4626 vaults | morphov1vaults | vaults (position) |
| Updated vaults | morphov2vaults | vaults (position) |
Read: Adapter Reference
Study the code and config examples for your chosen base adapter.
Phase 3: Implement Your Adapter (~1-2 hours)
3.1 Clone the Repository
git clone https://github.com/absinthelabs/absinthe-adapters.git
cd absinthe-adapters
pnpm install3.2 Copy an Existing Adapter
# Copy the adapter most similar to your protocol
cp -r adapters/uniswap-v2 adapters/my-protocol3.3 Update the Manifest
Edit adapters/my-protocol/index.ts:
- Update adapter name
- Update version
3.4 Update Metadata
Edit adapters/my-protocol/metadata.ts:
- Update protocol name
- Update descriptions
3.5 Modify Event Handlers (if needed)
If your protocol has different events:
- Update ABI files
- Modify handler functions
- Adjust data transformations
3.6 Create Test Config
Create adapters/my-protocol/tests/config/test.absinthe.json:
- Add your contract addresses
- Set your chain ID
- Configure fromBlock
Phase 4: Test Locally (~30 min)
Read: Testing Guide
4.1 Run Your Adapter
pnpm run dev -- --config adapters/my-protocol/tests/config/test.absinthe.json4.2 Verify CSV Output
- Check that CSV files are generated
- Verify data format matches expected schema
- Cross-reference 2-3 transactions with block explorer
4.3 Common Issues
| Issue | Likely Cause | Fix |
|---|---|---|
| No CSV output | Wrong event signatures | Check ABI matches your contract |
| Missing data | fromBlock too recent | Set earlier fromBlock |
| Wrong values | Handler logic error | Debug handler functions |
Phase 5: Deploy & Verify (~30 min)
Once your adapter works locally, deploy it.
Follow: Deploy on Railway
After deployment:
- Check Railway logs for "Indexer started"
- Verify adapter appears in Absinthe "My Adapters"
- Confirm events are being received
Summary Checklist
| Phase | Time | Status |
|---|---|---|
| 1. Learn the System | ~30 min | ☐ |
| 2. Study Existing Adapters | ~45 min | ☐ |
| 3. Implement Your Adapter | ~1-2 hours | ☐ |
| 4. Test Locally | ~30 min | ☐ |
| 5. Deploy & Verify | ~30 min | ☐ |
| Total | ~2-4 hours |
Quick Reference
Useful Links
| Resource | Link |
|---|---|
| Adapters Repository | github.com/absinthelabs/absinthe-adapters |
| Example Configs | adapters/*/tests/config/ in repo |
| Deploy Guide | Deploy on Railway |
Getting Help
- Slack: Absinthe Community
- Issues: Open a GitHub issue
- Examples: Check existing adapter configs
Next Steps
Once deployed and verified:
- Return to the Absinthe App
- Your adapter will appear in "My Adapters"
- CMO can now configure point distribution rules