Skip to content

track virtus protocol tvl#18519

Merged
bheluga merged 2 commits intoDefiLlama:mainfrom
bheluga:virtus-protocol
Mar 24, 2026
Merged

track virtus protocol tvl#18519
bheluga merged 2 commits intoDefiLlama:mainfrom
bheluga:virtus-protocol

Conversation

@bheluga
Copy link
Member

@bheluga bheluga commented Mar 24, 2026

Summary by CodeRabbit

  • New Features
    • Integrated Virtus Protocol into the platform
    • Added support for both Uniswap V2 and V3 pool configurations
    • Enabled automated pool discovery and tracking for the new protocol
    • Protocol registry entries now configured for system integration

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

Two new integrations added to support the Virtus Protocol: a Uniswap V3-style module configuration for the protocol's concentrated liquidity component, and a Uniswap V2-style registry entry with factory address and ABI definitions for the base protocol.

Changes

Cohort / File(s) Summary
Uniswap V3 Protocol Configuration
projects/virtus-protocol-cl/index.js
New module exporting Uniswap V3 configuration for Virtus Protocol with factory address 0x0e5Ab24beBdA7e5Bb3961f7E9b3532a83aE86B48, starting block 42960000, and PoolCreated event ABI.
Uniswap V2 Registry Entry
registries/uniswapV2.js
Added virtus-protocol registry configuration with factory address and ABI options for allPoolsLength and allPools function selectors.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A protocol born on base so bright,
With V3 pools and factories in sight,
V2 registry entries, neat and clean,
The finest Virtus integration we've seen! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR has no description provided; the template requires information for new listings including name, audit links, website, TVL, chain, and other protocol details. Add a comprehensive description following the template structure with protocol information, audit links, website, current TVL, blockchain chain, and other required listing details.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'track virtus protocol tvl' clearly describes the main objective of the PR—adding TVL tracking for Virtus Protocol.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@llamabutler
Copy link

The adapter at virtus-protocol exports TVL:

base                      19.98 k

total                    19.98 k 

@llamabutler
Copy link

The adapter at projects/virtus-protocol-cl exports TVL:

base                      0.00

total                    0.00 

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@projects/virtus-protocol-cl/index.js`:
- Around line 6-7: The PoolCreated event ABI in this adapter is incorrect and
missing the uint24 fee and has wrong parameter order; update the eventAbi string
(the one currently set to 'event PoolCreated(address indexed token0, address
indexed token1, int24 indexed tickSpacing, address pool)') to match the
canonical Uniswap V3 signature from projects/helper/uniswapV3.js:
'PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee,
int24 tickSpacing, address pool)' so the decoder can parse logs correctly (do
not change the topics logic).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3a29b07b-371c-483f-a19e-5caaff7f2af9

📥 Commits

Reviewing files that changed from the base of the PR and between 961d242 and 8eca8f3.

📒 Files selected for processing (2)
  • projects/virtus-protocol-cl/index.js
  • registries/uniswapV2.js

Comment on lines +6 to +7
fromBlock: 42960000,
eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, int24 indexed tickSpacing, address pool)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify which PoolCreated signature actually emits logs for the target factory on Base RPC.
python - <<'PY'
import json, requests, subprocess, sys
try:
    from eth_utils import keccak
except Exception:
    subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "eth-utils"])
    from eth_utils import keccak

rpc = "https://mainnet.base.org"
factory = "0x0e5Ab24beBdA7e5Bb3961f7E9b3532a83aE86B48"
from_block = 42960000

def rpc_call(method, params):
    r = requests.post(rpc, json={"jsonrpc":"2.0","id":1,"method":method,"params":params}, timeout=30)
    r.raise_for_status()
    return r.json()["result"]

latest = int(rpc_call("eth_blockNumber", []), 16)

signatures = {
    "current_in_file": "PoolCreated(address,address,int24,address)",
    "uniswap_v3_canonical": "PoolCreated(address,address,uint24,int24,address)",
}

for name, sig in signatures.items():
    topic0 = "0x" + keccak(text=sig).hex()
    logs = rpc_call("eth_getLogs", [{
        "address": factory,
        "fromBlock": hex(from_block),
        "toBlock": hex(latest),
        "topics": [topic0]
    }])
    print(f"{name}: {len(logs)} logs, topic0={topic0}")
PY

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 592


🏁 Script executed:

# First, find and read the adapter file
find . -path "*/virtus-protocol-cl/*" -type f | head -20

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 110


🏁 Script executed:

# Search for the adapter file more broadly
fd -e "index.js" | grep -i virtus | head -5

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 54


🏁 Script executed:

# List files in projects directory to understand structure
ls -la projects/ | head -30

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 1834


🏁 Script executed:

cat -n projects/virtus-protocol-cl/index.js

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 465


🏁 Script executed:

# Check the uniswapV3 helper to understand what event signature is expected
cat -n helper/uniswapV3.js | head -80

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 123


🏁 Script executed:

# Find other Uniswap V3 adapters to compare event ABI patterns
grep -r "PoolCreated" projects --include="*.js" | head -20

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 3565


🏁 Script executed:

# Search for Uniswap V3 adapters specifically
grep -r "uniV3Export\|uniswapV3" projects --include="*.js" -l | head -20

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 628


🏁 Script executed:

# Look for other adapters on Base chain
grep -r "base.*factory\|factory.*base" projects --include="*.js" -B2 -A2 | head -40

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 3756


🏁 Script executed:

# Find and read the uniswapV3 helper
cat -n projects/helper/uniswapV3.js | head -150

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 3627


🏁 Script executed:

# Verify the topic hash for the correct signature
python3 << 'EOF'
from hashlib import sha256

# Canonical Uniswap V3 signature
canonical = "PoolCreated(address,address,uint24,int24,address)"

# Current virtus signature (wrong)
current = "PoolCreated(address,address,int24,address)"

def keccak256(s):
    # Simple approximation - using sha256 for demonstration
    import hashlib
    return hashlib.sha256(s.encode()).hexdigest()

# Actually compute Keccak256 (need to import)
try:
    from Crypto.Hash import keccak
    k = keccak.new(digest_bits=256)
    k.update(canonical.encode())
    canonical_hash = k.hexdigest()
    
    k2 = keccak.new(digest_bits=256)
    k2.update(current.encode())
    current_hash = k2.hexdigest()
    
    print(f"Canonical signature: {canonical}")
    print(f"Canonical topic:    0x{canonical_hash}")
    print()
    print(f"Current signature:   {current}")
    print(f"Current topic:       0x{current_hash}")
    print()
    print(f"Topics match: {canonical_hash == current_hash}")
except ImportError:
    print("Note: Crypto library not available, but we can verify via helper file")
    print(f"Helper specifies topic: 0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118")
    print("This matches the canonical Uniswap V3 signature, not the current virtus signature")
EOF

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 314


🏁 Script executed:

# Check if adapter is supposed to override topics
grep -A5 -B5 "virtus" projects/helper/uniswapV3.js

Repository: DefiLlama/DefiLlama-Adapters

Length of output: 54


Fix PoolCreated event ABI to match Uniswap V3 canonical signature.

The current ABI is missing the uint24 indexed fee parameter and has incorrect parameter ordering. The helper's canonical Uniswap V3 signature (projects/helper/uniswapV3.js:6) is PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool). Since the adapter overrides eventAbi but not topics, it uses the correct topic hash but fails to decode events with the wrong ABI, resulting in zero TVL.

🔧 Proposed fix
 module.exports = uniV3Export({
     base: {
         factory: '0x0e5Ab24beBdA7e5Bb3961f7E9b3532a83aE86B48',
         fromBlock: 42960000,
-        eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, int24 indexed tickSpacing, address pool)',
+        eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)',
       },
 })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fromBlock: 42960000,
eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, int24 indexed tickSpacing, address pool)',
module.exports = uniV3Export({
base: {
factory: '0x0e5Ab24beBdA7e5Bb3961f7E9b3532a83aE86B48',
fromBlock: 42960000,
eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)',
},
})
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@projects/virtus-protocol-cl/index.js` around lines 6 - 7, The PoolCreated
event ABI in this adapter is incorrect and missing the uint24 fee and has wrong
parameter order; update the eventAbi string (the one currently set to 'event
PoolCreated(address indexed token0, address indexed token1, int24 indexed
tickSpacing, address pool)') to match the canonical Uniswap V3 signature from
projects/helper/uniswapV3.js: 'PoolCreated(address indexed token0, address
indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)' so the
decoder can parse logs correctly (do not change the topics logic).

@bheluga bheluga merged commit 3b369bc into DefiLlama:main Mar 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants