Skip to content

feat: everything initial integration#18681

Open
ra2-alfred-g wants to merge 4 commits intoDefiLlama:mainfrom
petra-foundation:feature/everything-integration
Open

feat: everything initial integration#18681
ra2-alfred-g wants to merge 4 commits intoDefiLlama:mainfrom
petra-foundation:feature/everything-integration

Conversation

@ra2-alfred-g
Copy link
Copy Markdown

@ra2-alfred-g ra2-alfred-g commented Apr 7, 2026

NOTE

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


  1. If you would like to add a volume/fees/revenue adapter please submit the PR here.

  2. 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.

  3. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.

  4. For updating listing info It is a different repo, you can find your listing in this file, you can edit it there and put up a PR

  5. Please do not add new npm dependencies, do not edit/push pnpm-lock.yaml file as part of your changes


(Needs to be filled only for new listings)

Name (to be shown on DefiLlama):

Everything

Twitter Link:

https://twitter.com/SmarDex

List of audit links if any:
Website Link:

https://everything.inc/

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

~$2.04M

Treasury Addresses (if the protocol has treasury)

0x1d13a5aefd4d3a0f466c0058526d8bf11d88502a

Chain:

Arbitrum

Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list)

everything

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)

39394

Short Description (to be shown on DefiLlama):

Everything is an AMM combined with oracle-less lending, enabling token swaps and collateralized borrowing within the same pair contracts.

Token address and ticker if any:

EV - 0xe7e7e741c23a4767831a56a8c99f522c5ac1e7e7 (Arbitrum)

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

Dexes

Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.):

None (oracle-less design — lending liquidation prices are determined by AMM pair reserves)

Implementation Details: Briefly describe how the oracle is integrated into your project:

The protocol does not rely on any external oracle. Borrowing and liquidation parameters are derived directly from the AMM pair's virtual reserves and tick-based pricing mechanism.

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

N/A — oracle-less by design

forkedFrom (Does your project originate from another project):

No

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

TVL is calculated by summing the token balances held in all AMM pair contracts and the vault contract on-chain. Pair contracts hold LP reserves (token0 + token1). The vault holds collateral deposited by borrowers (which may be deployed into Aave for yield). Borrowed amounts are tracked separately via getTotalBorrowed0 and getTotalBorrowed1 on each pair.

Github org/user (Optional, if your code is open source, we can track activity):
Does this project have a referral program?

Summary by CodeRabbit

  • New Features

    • Added Arbitrum support for DeFi accounting: computes Total Value Locked (TVL) across AMM pools and attributes vault collateral.
    • Tracks total borrowed amounts per token across pools and aggregates balances.
  • Documentation

    • Added a methodology description explaining how TVL and borrowed figures are computed.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0ea2450b-c760-4e4e-a3c8-4159da501ee4

📥 Commits

Reviewing files that changed from the base of the PR and between 6ad10f5 and be47bb0.

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

📝 Walkthrough

Walkthrough

Adds projects/everything/index.js: chain-scoped Arbitrum handlers that enumerate factory pairs, read each pair’s token addresses and per-pair borrowed totals, deduplicate tokens, attribute pair liquidity and vault-owned tokens, and aggregate TVL and borrowed balances via api calls.

Changes

Cohort / File(s) Summary
Arbitrum handlers
projects/everything/index.js
New module exporting methodology and chain-specific handlers (arbitrum.tvl, arbitrum.borrowed). Enumerates factory pairs (getAllPairsLength / getPairAtIndex), reads pair tokens (getTokens), deduplicates tokens, builds ownerTokens (pairs + configured vault), calls api.sumTokens for TVL, and aggregates per-token borrowed amounts using getTotalBorrowed0 / getTotalBorrowed1 with api.add / api.getBalances. Review focus: contract call parameters, loop/index bounds, token deduplication, aggregation and owner attribution.

Sequence Diagram(s)

sequenceDiagram
    participant api as API Handler
    participant factory as Factory Contract
    participant pair as Pair Contract
    participant vault as Vault (config)

    rect rgba(100,150,200,0.5)
    Note over api,factory: TVL Calculation Flow
    api->>factory: getAllPairsLength()
    factory-->>api: pairCount
    loop for i in 0..pairCount-1
      api->>factory: getPairAtIndex(i)
      factory-->>api: pairAddress
      api->>pair: getTokens()
      pair-->>api: token0, token1
    end
    api->>api: deduplicate tokens
    api->>vault: read vault address from config
    api->>api: api.sumTokens({ ownerTokens })
    end
Loading
sequenceDiagram
    participant api as API Handler
    participant factory as Factory Contract
    participant pair as Pair Contract

    rect rgba(200,100,150,0.5)
    Note over api,pair: Borrowed Balance Flow
    api->>factory: getAllPairsLength()
    factory-->>api: pairCount
    loop for i in 0..pairCount-1
      api->>factory: getPairAtIndex(i)
      factory-->>api: pairAddress
      api->>pair: getTokens()
      pair-->>api: token0, token1
      api->>pair: getTotalBorrowed0()
      pair-->>api: borrowed0
      api->>pair: getTotalBorrowed1()
      pair-->>api: borrowed1
      api->>api: api.add(token0, borrowed0)
      api->>api: api.add(token1, borrowed1)
    end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through factory rows and pairs,
I counted tokens, vaults, and cares,
I summed the TVL with gentle paws,
I tallied borrows without a pause,
Arbitrum ledgers — my joyful cause ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding an initial adapter integration for the Everything protocol on Arbitrum.
Description check ✅ Passed The pull request description follows the required template and includes all critical sections for a new listing: protocol metadata, TVL information, chain details, methodology, and relevant contact information.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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: 1

🧹 Nitpick comments (1)
projects/everything/index.js (1)

10-16: Extract shared pair/token discovery into one helper

fetchList + getTokens is duplicated in both handlers. A small getPairsAndTokens(api) helper will reduce drift risk when ABI or pair filtering changes.

♻️ Suggested refactor
+async function getPairsAndTokens(api) {
+  const { factory } = config[api.chain]
+  const pairs = await api.fetchList({
+    lengthAbi: 'uint256:getAllPairsLength',
+    itemAbi: 'function getPairAtIndex(uint256) view returns (address)',
+    target: factory,
+  })
+  const tokens = await api.multiCall({ abi: 'function getTokens() view returns (address, address)', calls: pairs })
+  return { pairs, tokens }
+}
+
 async function tvl(api) {
-  const { factory, vault } = config[api.chain]
-  const pairs = await api.fetchList({
-    lengthAbi: 'uint256:getAllPairsLength',
-    itemAbi: 'function getPairAtIndex(uint256) view returns (address)',
-    target: factory,
-  })
-  const tokens = await api.multiCall({ abi: 'function getTokens() view returns (address, address)', calls: pairs })
+  const { vault } = config[api.chain]
+  const { pairs, tokens } = await getPairsAndTokens(api)
   const ownerTokens = pairs.map((pair, i) => [tokens[i], pair])
   const allTokens = [...new Set(tokens.flat())]
   ownerTokens.push([allTokens, vault])
   return api.sumTokens({ ownerTokens })
 }
 
 async function borrowed(api) {
-  const { factory } = config[api.chain]
-  const pairs = await api.fetchList({
-    lengthAbi: 'uint256:getAllPairsLength',
-    itemAbi: 'function getPairAtIndex(uint256) view returns (address)',
-    target: factory,
-  })
-  const tokens = await api.multiCall({ abi: 'function getTokens() view returns (address, address)', calls: pairs })
+  const { pairs, tokens } = await getPairsAndTokens(api)
   const borrowed0 = await api.multiCall({ abi: 'uint256:getTotalBorrowed0', calls: pairs })
   const borrowed1 = await api.multiCall({ abi: 'uint256:getTotalBorrowed1', calls: pairs })

Also applies to: 24-31

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

In `@projects/everything/index.js` around lines 10 - 16, Extract the duplicated
logic that calls api.fetchList and api.multiCall into a single helper (e.g.,
getPairsAndTokens(api, factory)) that performs the fetchList (using lengthAbi
'uint256:getAllPairsLength' and itemAbi 'function getPairAtIndex(uint256)') and
then calls multiCall with abi 'function getTokens() view returns (address,
address)' to return an object { pairs, tokens } (or [pairs, tokens]); replace
the duplicated blocks that build pairs, tokens and ownerTokens (the code using
pairs.map to create ownerTokens) in both handlers with calls to
getPairsAndTokens and derive ownerTokens from the returned pairs and tokens.
🤖 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/everything/index.js`:
- Around line 17-19: The current TVL path only adds the vault's raw token list
(allTokens) to ownerTokens before calling api.sumTokens, which misses
receipt/deployed-position tokens (e.g., aTokens); update the logic to also
include the deployed-position/receipt-token set derived from tokens (or
vault-level total collateral) by collecting those addresses (e.g.,
deployedTokens or receiptTokens from the tokens array), deduping them, and
adding an additional ownerTokens entry (e.g., ownerTokens.push([deployedTokens,
vault]) or equivalent) so api.sumTokens counts both the vault-held tokens and
any deployed/receipt-token balances.

---

Nitpick comments:
In `@projects/everything/index.js`:
- Around line 10-16: Extract the duplicated logic that calls api.fetchList and
api.multiCall into a single helper (e.g., getPairsAndTokens(api, factory)) that
performs the fetchList (using lengthAbi 'uint256:getAllPairsLength' and itemAbi
'function getPairAtIndex(uint256)') and then calls multiCall with abi 'function
getTokens() view returns (address, address)' to return an object { pairs, tokens
} (or [pairs, tokens]); replace the duplicated blocks that build pairs, tokens
and ownerTokens (the code using pairs.map to create ownerTokens) in both
handlers with calls to getPairsAndTokens and derive ownerTokens from the
returned pairs and tokens.
🪄 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: a18acae6-bcec-42f2-91aa-3dbcd082f45c

📥 Commits

Reviewing files that changed from the base of the PR and between bc06edd and 5e64d79.

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

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.

🧹 Nitpick comments (1)
projects/everything/index.js (1)

29-39: Add explicit return for consistency with other adapters.

The borrowed function uses api.add() to accumulate balances but doesn't return the result. While the framework may handle this via fallback, explicitly returning api.getBalances() aligns with the established pattern in other adapters (e.g., multiplierfinance/index.js).

♻️ Proposed fix
 async function borrowed(api) {
   const { factory } = config[api.chain]
   const { pairs, tokens } = await getPairsAndTokens(api, factory)
   const borrowed0 = await api.multiCall({ abi: 'uint256:getTotalBorrowed0', calls: pairs })
   const borrowed1 = await api.multiCall({ abi: 'uint256:getTotalBorrowed1', calls: pairs })
   for (let i = 0; i < pairs.length; i++) {
     api.add(tokens[i][0], borrowed0[i])
     api.add(tokens[i][1], borrowed1[i])
   }
+  return api.getBalances()
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@projects/everything/index.js` around lines 29 - 39, The borrowed function
currently accumulates balances via api.add but does not explicitly return them;
update the async borrowed(api) function (which uses getPairsAndTokens,
api.multiCall, and api.add) to return the accumulated balances by calling and
returning api.getBalances() at the end so it matches other adapters' patterns
(e.g., multiplierfinance) and ensures a consistent explicit return value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@projects/everything/index.js`:
- Around line 29-39: The borrowed function currently accumulates balances via
api.add but does not explicitly return them; update the async borrowed(api)
function (which uses getPairsAndTokens, api.multiCall, and api.add) to return
the accumulated balances by calling and returning api.getBalances() at the end
so it matches other adapters' patterns (e.g., multiplierfinance) and ensures a
consistent explicit return value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3d862ad6-d806-42cc-bf05-322e15bf844e

📥 Commits

Reviewing files that changed from the base of the PR and between 9c72442 and 6ad10f5.

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

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.

1 participant