Skip to content

Add KYO AG volume indexing adapter#6272

Merged
bheluga merged 3 commits intoDefiLlama:masterfrom
kyo-ag:master
Mar 29, 2026
Merged

Add KYO AG volume indexing adapter#6272
bheluga merged 3 commits intoDefiLlama:masterfrom
kyo-ag:master

Conversation

@kyo-ag
Copy link
Copy Markdown
Contributor

@kyo-ag kyo-ag commented Mar 26, 2026

NOTE

Please enable "Allow edits by maintainers" while putting up the PR.


  • If you would like to add a tvl adapter please submit the PR here.
  1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.
  2. Please fill the form below only if the PR is for listing a new protocol else it can be ignored/replaced with reason/details about the PR
  3. For updating listing info It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data4.ts, you can edit it there and put up a PR
  4. Do not edit/push package.json/package-lock.json file as part of your changes
  5. No need to go to our discord/other channel and announce that you've created a PR, we monitor all PRs and will review it asap

Name (to be shown on DefiLlama):

Kyo Ag

Twitter Link:

https://x.com/kyo_ag

List of audit links if any:

https://docs.kyo.finance/resources/security

Website Link:

https://kyo.ag

Logo (High resolution, will be shown with rounded borders):

SVG : https://raw.githubusercontent.com/kyo-ag/brandkit/055a4cde0d48d02b849b3629e23bc58e1581c020/Kyoag_Symbol.svg
PNG : https://raw.githubusercontent.com/kyo-ag/brandkit/refs/heads/main/Kyoag_Symbol.png

Current TVL:

Dex aggregator

Chain:

Multi-chain dex aggregator (19+ chains will be supported)

Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list)
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000)
Short Description (to be shown on DefiLlama):

KYO AG is a cross-chain bridge, meta aggregator, and DEX aggregator for optimal token swaps and bridge routing across multiple networks. KyoAg's multi-chain DEX aggregator is built in Rust for speed, with mathematically optimal routing.

Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one:

DEX Aggregator

Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage:

https://docs.kyo.ag

forkedFrom (Does your project originate from another project):
methodology (what is being counted as tvl, how is tvl being calculated):
Github org/user (Optional, if your code is open source, we can track activity):

https://github.com/kyo-ag

Does this project have a referral program?

Not yet, but going to.

Summary by CodeRabbit

  • New Features
    • Added KYO AG volume aggregation across Hyperliquid, Monad, and Soneium networks with chain-specific start dates.
    • Indexes swap events plus inbound transfers/deposits, excludes router-to-router/internal hops, and deduplicates per transaction using the earliest inbound.
    • Classifies wrapped-native deposits versus ERC‑20 inflows and includes an explicit methodology describing event-based vs earliest-inbound fallback indexing.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

A new KYO AG aggregator was added to index inbound volume across Hyperliquid, Monad, and Soneium by combining SwapExecuted events with ERC-20 Transfer and native Deposit logs, deduplicating per transaction and attributing earliest inbound token flows to daily volume.

Changes

Cohort / File(s) Summary
KYO AG Aggregator Module
aggregators/kyoag/index.ts
Adds a new SimpleAdapter (version: 2, pullHourly: true) for CHAIN.HYPERLIQUID, CHAIN.MONAD, CHAIN.SONEIUM with chain-specific start dates. Implements fetch that: collects SwapExecuted events to mark swap txs, builds allowlists (event routers, legacy routers, allowlisted logic contracts, wrapped-native tokens), queries ERC-20 Transfer and native Deposit logs to tracked targets, filters and excludes router-origin or swap-marked txs, deduplicates inbound logs per transaction by earliest log index, and aggregates daily volume (treating wrapped-native deposits as gas inflow). Exports adapter and includes methodology description.

Sequence Diagram

sequenceDiagram
    participant Adapter as KYO AG Adapter
    participant EventRouter as Event Routers
    participant Contracts as ERC-20 / Native Contracts
    participant Store as Volume Store

    Adapter->>EventRouter: Query `SwapExecuted` events (per chain)
    EventRouter-->>Adapter: Return swap logs (tx hashes, srcToken, amountIn)

    Adapter->>Adapter: Build swap tx hash set (mark swap txs)

    Adapter->>Contracts: Query `Transfer` logs to router/logic targets
    Adapter->>Contracts: Query native `Deposit` logs to targets
    Contracts-->>Adapter: Return transfer/deposit logs

    Adapter->>Adapter: Filter logs (positive value, exclude router-origin, not swap txs)
    Adapter->>Adapter: Aggregate candidates and dedupe by earliest log (logIndex/index)

    Adapter->>Store: Update `dailyVolume` (wrapped-native as gas inflow, others as ERC-20 inflow)
    Store-->>Adapter: Confirm volume update
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through logs both wide and deep,
Chased swaps and transfers, no double-counted heap,
Three chains I checked, the earliest I found,
Volumes aggregated, neatly homeward bound,
sniff — KYO AG numbers safe and sound.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a KYO AG volume indexing adapter.
Description check ✅ Passed The PR description properly fills the required template with protocol details, links, and category information for a new adapter listing.
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.

Copy link
Copy Markdown
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: 2

🧹 Nitpick comments (1)
aggregators/kyoag/index.ts (1)

16-42: Add a guardrail for the manual allowlists.

These hard-coded router/logic lists will silently miss volume whenever Kyo deploys a new executor. A lightweight config test or registry-driven source would make the adapter safer to keep current.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@aggregators/kyoag/index.ts` around lines 16 - 42, Add a guardrail to ensure
the hard-coded LOGICS allowlist stays current by verifying it at startup (or in
a scheduled test) against the on-chain router/logic registry: implement a small
check (e.g., validateLogicsAgainstRegistry or initAndValidateLogics) that
iterates LOGICS for each CHAIN entry, queries the router or registry contract
for active logic/executor addresses, and logs or throws if any active logic is
missing from LOGICS (or optionally auto-merge new addresses into a safe dynamic
config); ensure the check uses CHAIN and LOGICS identifiers so it runs before
indexing begins and surfaces mismatches as warnings/errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@aggregators/kyoag/index.ts`:
- Around line 94-99: The current getLogs call (getLogs({... topics:
[DEPOSIT_TOPIC, padded], noTarget: true ...})) will match any contract emitting
Deposit(address,uint256); after collecting depositLogs, add a post-filter that
restricts logs to only those emitted by the chain’s wrapped-native token
addresses using a per-chain allowlist (e.g., compare log.address against a
WrappedNativeAllowlist map keyed by chainId). Update the code paths that build
depositLogs (including the similar block at the other occurrence) to reject logs
whose log.address is not in the allowlist before they are counted as
swap/deposit volume.
- Around line 102-115: The loops over transferLogs and depositLogs currently
only skip empty payloads (log.data === "0x") but still include zero-value
events; update both loops (the transferLogs and depositLogs iterations) to also
skip logs where the decoded amount is zero by checking BigInt(log.data) === 0n
(after handling the '0x' case) so zero-amount Transfer/Deposit events are
ignored before selecting the first inflow.

---

Nitpick comments:
In `@aggregators/kyoag/index.ts`:
- Around line 16-42: Add a guardrail to ensure the hard-coded LOGICS allowlist
stays current by verifying it at startup (or in a scheduled test) against the
on-chain router/logic registry: implement a small check (e.g.,
validateLogicsAgainstRegistry or initAndValidateLogics) that iterates LOGICS for
each CHAIN entry, queries the router or registry contract for active
logic/executor addresses, and logs or throws if any active logic is missing from
LOGICS (or optionally auto-merge new addresses into a safe dynamic config);
ensure the check uses CHAIN and LOGICS identifiers so it runs before indexing
begins and surfaces mismatches as warnings/errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9dc34975-78a1-468a-9868-b10ee1f84202

📥 Commits

Reviewing files that changed from the base of the PR and between e667fe5 and a3a3364.

📒 Files selected for processing (1)
  • aggregators/kyoag/index.ts

@llamabutler
Copy link
Copy Markdown

The kyoag adapter exports:

> adapters@1.0.0 test
> ts-node --transpile-only cli/testAdapter.ts aggregators kyoag

🦙 Running KYOAG adapter 🦙
---------------------------------------------------
Start Date:	Wed, 25 Mar 2026 15:33:58 GMT
End Date:	Thu, 26 Mar 2026 15:33:58 GMT
---------------------------------------------------

------ ERROR ------
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at fetch (/home/runner/work/dimension-adapters/dimension-adapters/aggregators/kyoag/index.ts:78:40)
    at async getChainResult (/home/runner/work/dimension-adapters/dimension-adapters/adapters/utils/runAdapter.ts:260:18)
Cannot read properties of undefined (reading 'toLowerCase')

@kyo-ag kyo-ag changed the title kyoag Add KYO AG volume indexing adapter Mar 26, 2026
@llamabutler
Copy link
Copy Markdown

The kyoag adapter exports:

> adapters@1.0.0 test
> ts-node --transpile-only cli/testAdapter.ts aggregators kyoag

🦙 Running KYOAG adapter 🦙
---------------------------------------------------
Start Date:	Thu, 26 Mar 2026 01:14:29 GMT
End Date:	Fri, 27 Mar 2026 01:14:29 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 3.88 k       | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 26.67 k      | 30/12/2025
Aggregate   | 30.55 k      |           

@bheluga bheluga self-assigned this Mar 27, 2026
@bheluga bheluga merged commit 66759f9 into DefiLlama:master Mar 29, 2026
2 of 3 checks passed
@llamabutler
Copy link
Copy Markdown

The kyoag adapter exports:

> adapters@1.0.0 test
> ts-node --transpile-only cli/testAdapter.ts aggregators kyoag

🦙 Running KYOAG adapter 🦙
---------------------------------------------------
Start Date:	Sat, 28 Mar 2026 12:00:00 GMT
End Date:	Sun, 29 Mar 2026 12:00:00 GMT
---------------------------------------------------

Slice 0:
Start Date:	Sat, 28 Mar 2026 12:00:00 GMT
End Date:	Sat, 28 Mar 2026 13:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.94 k       | 30/12/2025
Aggregate   | 1.94 k       |           

Slice 1:
Start Date:	Sat, 28 Mar 2026 13:00:00 GMT
End Date:	Sat, 28 Mar 2026 14:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 13.00        | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.15 k       | 30/12/2025
Aggregate   | 1.16 k       |           

Slice 2:
Start Date:	Sat, 28 Mar 2026 14:00:00 GMT
End Date:	Sat, 28 Mar 2026 15:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.21 k       | 30/12/2025
Aggregate   | 1.21 k       |           

Slice 3:
Start Date:	Sat, 28 Mar 2026 15:00:00 GMT
End Date:	Sat, 28 Mar 2026 16:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 28.00        | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.34 k       | 30/12/2025
Aggregate   | 1.37 k       |           

Slice 4:
Start Date:	Sat, 28 Mar 2026 16:00:00 GMT
End Date:	Sat, 28 Mar 2026 17:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 1.16 k       | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 951.00       | 30/12/2025
Aggregate   | 2.11 k       |           

Slice 5:
Start Date:	Sat, 28 Mar 2026 17:00:00 GMT
End Date:	Sat, 28 Mar 2026 18:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 579.00       | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.32 k       | 30/12/2025
Aggregate   | 1.90 k       |           

Slice 6:
Start Date:	Sat, 28 Mar 2026 18:00:00 GMT
End Date:	Sat, 28 Mar 2026 19:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 3.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 306.00       | 30/12/2025
Aggregate   | 309.00       |           

Slice 7:
Start Date:	Sat, 28 Mar 2026 19:00:00 GMT
End Date:	Sat, 28 Mar 2026 20:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 2.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 906.00       | 30/12/2025
Aggregate   | 908.00       |           

Slice 8:
Start Date:	Sat, 28 Mar 2026 20:00:00 GMT
End Date:	Sat, 28 Mar 2026 21:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 1.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 434.00       | 30/12/2025
Aggregate   | 435.00       |           

Slice 9:
Start Date:	Sat, 28 Mar 2026 21:00:00 GMT
End Date:	Sat, 28 Mar 2026 22:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 524.00       | 30/12/2025
Aggregate   | 524.00       |           

Slice 10:
Start Date:	Sat, 28 Mar 2026 22:00:00 GMT
End Date:	Sat, 28 Mar 2026 23:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 716.00       | 30/12/2025
Aggregate   | 716.00       |           

Slice 11:
Start Date:	Sat, 28 Mar 2026 23:00:00 GMT
End Date:	Sun, 29 Mar 2026 00:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 174.00       | 30/12/2025
Aggregate   | 174.00       |           

Slice 12:
Start Date:	Sun, 29 Mar 2026 00:00:00 GMT
End Date:	Sun, 29 Mar 2026 01:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 304.00       | 30/12/2025
Aggregate   | 304.00       |           

Slice 13:
Start Date:	Sun, 29 Mar 2026 01:00:00 GMT
End Date:	Sun, 29 Mar 2026 02:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 2.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 95.00        | 30/12/2025
Aggregate   | 97.00        |           

Slice 14:
Start Date:	Sun, 29 Mar 2026 02:00:00 GMT
End Date:	Sun, 29 Mar 2026 03:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.09 k       | 30/12/2025
Aggregate   | 1.09 k       |           

Slice 15:
Start Date:	Sun, 29 Mar 2026 03:00:00 GMT
End Date:	Sun, 29 Mar 2026 04:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 333.00       | 30/12/2025
Aggregate   | 333.00       |           

Slice 16:
Start Date:	Sun, 29 Mar 2026 04:00:00 GMT
End Date:	Sun, 29 Mar 2026 05:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 6.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 711.00       | 30/12/2025
Aggregate   | 717.00       |           

Slice 17:
Start Date:	Sun, 29 Mar 2026 05:00:00 GMT
End Date:	Sun, 29 Mar 2026 06:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.14 k       | 30/12/2025
Aggregate   | 1.14 k       |           

Slice 18:
Start Date:	Sun, 29 Mar 2026 06:00:00 GMT
End Date:	Sun, 29 Mar 2026 07:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.15 k       | 30/12/2025
Aggregate   | 1.15 k       |           

Slice 19:
Start Date:	Sun, 29 Mar 2026 07:00:00 GMT
End Date:	Sun, 29 Mar 2026 08:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 2.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.13 k       | 30/12/2025
Aggregate   | 1.13 k       |           

Slice 20:
Start Date:	Sun, 29 Mar 2026 08:00:00 GMT
End Date:	Sun, 29 Mar 2026 09:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 776.00       | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.33 k       | 30/12/2025
Aggregate   | 2.11 k       |           

Slice 21:
Start Date:	Sun, 29 Mar 2026 09:00:00 GMT
End Date:	Sun, 29 Mar 2026 10:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 1.43 k       | 30/12/2025
Aggregate   | 1.43 k       |           

Slice 22:
Start Date:	Sun, 29 Mar 2026 10:00:00 GMT
End Date:	Sun, 29 Mar 2026 11:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 0.00         | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 690.00       | 30/12/2025
Aggregate   | 690.00       |           

Slice 23:
Start Date:	Sun, 29 Mar 2026 11:00:00 GMT
End Date:	Sun, 29 Mar 2026 12:00:00 GMT
---------------------------------------------------

chain       | Daily volume | Start Time
---         | ---          | ---       
hyperliquid | 13.00        | 3/2/2026  
monad       | 0.00         | 23/3/2026 
soneium     | 785.00       | 30/12/2025
Aggregate   | 798.00       |           


====== TOTAL DAILY AGGREGATED (sum of slots per chain) ======

chain       | Daily volume
---         | ---         
hyperliquid | 2.59 k      
monad       | 0.00        
soneium     | 21.14 k     
Aggregate   | 23.73 k     

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.

3 participants