feat: everything initial integration#18681
feat: everything initial integration#18681ra2-alfred-g wants to merge 4 commits intoDefiLlama:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds Changes
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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
projects/everything/index.js (1)
10-16: Extract shared pair/token discovery into one helper
fetchList + getTokensis duplicated in both handlers. A smallgetPairsAndTokens(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
📒 Files selected for processing (1)
projects/everything/index.js
There was a problem hiding this comment.
🧹 Nitpick comments (1)
projects/everything/index.js (1)
29-39: Add explicit return for consistency with other adapters.The
borrowedfunction usesapi.add()to accumulate balances but doesn't return the result. While the framework may handle this via fallback, explicitly returningapi.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
📒 Files selected for processing (1)
projects/everything/index.js
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
If you would like to add a
volume/fees/revenueadapter please submit the PR here.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.
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.
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
Please do not add new npm dependencies, do not edit/push
pnpm-lock.yamlfile 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):
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
getTotalBorrowed0andgetTotalBorrowed1on 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
Documentation