Skip to content

Feat/travessia credit#18695

Open
RedVeil wants to merge 2 commits intoDefiLlama:mainfrom
RedVeil:feat/travessiaCredit
Open

Feat/travessia credit#18695
RedVeil wants to merge 2 commits intoDefiLlama:mainfrom
RedVeil:feat/travessiaCredit

Conversation

@RedVeil
Copy link
Copy Markdown
Contributor

@RedVeil RedVeil commented Apr 8, 2026

Name (to be shown on DefiLlama):

Travessia Credit

Twitter Link:

https://x.com/TravessiaCredit

List of audit links if any:

https://docs.travessiacredit.com/pages/security-audits-risk-controls.html

Website Link:

https://www.travessiacredit.com/

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

https://www.travessiacredit.com/travessia_logo_dark.webp

Current TVL:

$50k

Treasury Addresses (if the protocol has treasury)
Chain:

Monad, Ethereum

Short Description (to be shown on DefiLlama):

On-chain credit infrastructure for real-world assets.

Category (full list at https://defillama.com/categories) *Please choose only one:

RWA Lending

methodology (what is being counted as tvl, how is tvl being calculated):

We work with Accountable Vaults. The contracts are ERC-7540 compliant. We track totalAssets and borrows.

Github org/user (Optional, if your code is open source, we can track activity):

https://github.com/RedVeil

Summary by CodeRabbit

  • New Features
    • Travessia protocol now supported on Monad and Ethereum networks
    • TVL and borrowed asset metrics available for Travessia vaults
    • Real-time vault state tracking enabled across supported chains

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

A new module for the Travessia protocol was created to calculate total value locked (TVL) and borrowed amounts across monad and ethereum chains. It queries vault supplies, underlying assets, and liquidity through multi-call queries to derive metrics.

Changes

Cohort / File(s) Summary
Travessia Protocol Module
projects/travessia/index.js
New module defining chain-specific vault registries and ABIs for monad and ethereum. Exports tvl and borrowed collectors that fetch vault totalSupply, convert to totalAssets via convertToAssets(), query underlying asset balances, and accumulate TVL with conditional logic based on the isBorrowed flag. Includes error handling with permitFailure: true for multi-call queries.

Sequence Diagram

sequenceDiagram
    participant Chain as Chain Provider
    participant Vault as Vault Contracts
    participant ERC20 as ERC20 Assets
    participant Aggregator as TVL Aggregator

    Aggregator->>Chain: Fetch vault totalSupply (multi-call)
    Chain-->>Aggregator: supplies[]

    Aggregator->>Vault: Call asset() for each vault
    Vault-->>Aggregator: underlyingAssets[]

    Aggregator->>Vault: Call convertToAssets(supply) for each vault
    Vault-->>Aggregator: totalAssets[]

    Aggregator->>ERC20: Query balanceOf(vault) for each underlying asset
    ERC20-->>Aggregator: liquidityBalances[]

    Aggregator->>Aggregator: Calculate TVL or Borrowed<br/>(totalAssets OR totalAssets - liquidity)
    Aggregator-->>Chain: Return accumulated value
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Vaults and assets, clear and bright,
Across the chains, we measure height,
Monad and Ethereum intertwine,
TVL calculated, oh so fine!
Borrowed or locked, the logic plays,
Travessia shines through protocol's maze! 🌙

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Feat/travessia credit' clearly indicates the addition of a Travessia Credit adapter, directly matching the main change in the changeset.
Description check ✅ Passed The PR description provides most required new-listing fields with adequate detail, including project name, website, audit links, chains, and methodology explanation.

✏️ 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
Copy Markdown

The adapter at projects/travessia exports TVL:

borrowed                  50.08 k
ethereum                  50.08 k
ethereum-borrowed         50.08 k
monad-borrowed            2.00
monad                     0.00

total                    50.08 k 

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

🤖 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/travessia/index.js`:
- Around line 18-19: The code currently assumes VAULTS[api.chain] exists which
can throw when undefined; update the logic around the const vaults =
VAULTS[api.chain] and the subsequent if check in projects/travessia/index.js
(the vaults variable) to first guard for undefined/null (e.g., if (!vaults ||
!vaults.length) return) so the code returns safely when the chain has no
configuration; ensure you reference and update the vaults variable and the
existing if-check rather than only checking .length.
- Around line 35-38: The loop in vaults.forEach uses liquidity[i] in a
subtraction when isBorrowed is true but doesn’t guard against liquidity being
null/undefined; update the loop (vaults.forEach) to check liquidity[i] before
subtracting (e.g., if (isBorrowed && (liquidity[i] == null)) return/continue to
skip this vault or treat missing liquidity as 0), and only call
api.add(underlyings[i], totalAssets[i] - liquidity[i]) when liquidity[i] is a
valid number; ensure you reference underlyings[i], totalAssets[i], liquidity[i],
isBorrowed, and api.add in the change so the subtraction never produces NaN or
throws.
🪄 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: a18207d2-58b5-4299-bee2-76672f3668ce

📥 Commits

Reviewing files that changed from the base of the PR and between 6c2721b and 93881fb.

📒 Files selected for processing (1)
  • projects/travessia/index.js

Comment on lines +18 to +19
const vaults = VAULTS[api.chain]
if (!vaults.length) return
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add guard against undefined chain configuration.

If VAULTS[api.chain] is undefined (e.g., a new chain is added to exports but not to VAULTS), accessing .length throws a TypeError.

🛡️ Proposed fix
   return async (api) => {
       const vaults = VAULTS[api.chain]
-      if (!vaults.length) return
+      if (!vaults?.length) return
📝 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
const vaults = VAULTS[api.chain]
if (!vaults.length) return
const vaults = VAULTS[api.chain]
if (!vaults?.length) return
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@projects/travessia/index.js` around lines 18 - 19, The code currently assumes
VAULTS[api.chain] exists which can throw when undefined; update the logic around
the const vaults = VAULTS[api.chain] and the subsequent if check in
projects/travessia/index.js (the vaults variable) to first guard for
undefined/null (e.g., if (!vaults || !vaults.length) return) so the code returns
safely when the chain has no configuration; ensure you reference and update the
vaults variable and the existing if-check rather than only checking .length.

Comment on lines +35 to +38
vaults.forEach((_, i) => {
if (!underlyings[i] || !totalAssets[i]) return
isBorrowed ? api.add(underlyings[i], totalAssets[i] - liquidity[i]) : api.add(underlyings[i], totalAssets[i])
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Borrowed calculation can fail when liquidity[i] is null/undefined.

Line 36 checks underlyings[i] and totalAssets[i] but not liquidity[i]. When the balanceOf call fails (e.g., invalid underlying address), liquidity[i] will be null/undefined due to permitFailure: true. The subtraction totalAssets[i] - liquidity[i] will then produce NaN or throw a TypeError.

🐛 Proposed fix
       vaults.forEach((_, i) => {
           if (!underlyings[i] || !totalAssets[i]) return
-          isBorrowed ? api.add(underlyings[i], totalAssets[i] - liquidity[i]) : api.add(underlyings[i], totalAssets[i])
+          if (isBorrowed) {
+              if (liquidity[i] == null) return
+              api.add(underlyings[i], totalAssets[i] - liquidity[i])
+          } else {
+              api.add(underlyings[i], totalAssets[i])
+          }
       })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@projects/travessia/index.js` around lines 35 - 38, The loop in vaults.forEach
uses liquidity[i] in a subtraction when isBorrowed is true but doesn’t guard
against liquidity being null/undefined; update the loop (vaults.forEach) to
check liquidity[i] before subtracting (e.g., if (isBorrowed && (liquidity[i] ==
null)) return/continue to skip this vault or treat missing liquidity as 0), and
only call api.add(underlyings[i], totalAssets[i] - liquidity[i]) when
liquidity[i] is a valid number; ensure you reference underlyings[i],
totalAssets[i], liquidity[i], isBorrowed, and api.add in the change so the
subtraction never produces NaN or throws.

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