Merging updates from defillama#3
Open
iagoLD wants to merge 6220 commits into
Open
Conversation
* Add adapter for pufETH yield * Add rewards APR through Merkl for puffer-stake adapter * Apply code rabbit suggestions for guards * Use 180d for base APY and remove 7d APY * Add searchTokenOverride and use ETH as underlying token * Use 30d for base APY and add 7d APY back
* use pagination instead of 1000 limit * use 50k tvl limit
* remove token address from holders * fetch 11 * ensure avg position stays accurate
* theo tbill * fix tvl dbl count
* add hastra adapter * tweaks
* add OnRe adapter * fix
* add superstate-ustb adapter * use format chain
chore: 🤖 add NUSD tranches in strata
* remove burned supply * exclude burn addresses * update to fetch 13
* add ankr fallback for suspicious data * update comment * cleaner * remove == null pools * ensure project gets triggered * remove dead code
* Refactor LP price calculation and APY function * Enhance fallback APY calculation and add URL Added fallback chart URL and improved fallback APY logic. * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js Switched to a stable 7d APY as the main metric and added apyBase30d for additional context. Also improved robustness with retries and block fallback for all on-chain reads. All checks are passing, ready to merge. * Update index.js Now using a stable 7d APY as the main metric with proper error handling and block fallback. All checks should pass. * fix: restore compounding APY, single 7d window, cleanup fields - Restore compound annualization (Math.pow) instead of linear - Use single 7d window for apyBase, remove redundant apy/apyBase7d - Fix rewardTokens: null -> [] - Lowercase underlyingTokens addresses Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: kr3p <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
* Add surf-liquid yield adapter Pools: - USDC/WETH/cbBTC vault pools with Morpho lending APY (after 10% fee) - SURF staking pool (14% for 6M, 18% for 12M lock) APY is sourced from Morpho GraphQL API for the underlying vaults that Surf Liquid deposits into, with 10% performance fee deducted. * Address reviewer feedback: on-chain APY, pool IDs, remove GraphQL dependency - Replace Morpho GraphQL API with on-chain share price calculation (totalAssets/totalSupply at current vs 1-day-ago blocks) - Derive staking APR from on-chain contract (apr6Months, apr12Months, BASIS_POINTS) instead of hardcoded value - Change pool IDs to use contract addresses (factory/staking address + chain) - Remove graphql-request dependency - Get asset prices from coins.llama.fi instead of Morpho API * Address reviewer feedback: remove hardcoded fallbacks, guard edge cases - Remove totalSupply fallback to '1'; skip vaults with zero supply instead of fabricating APY values - Guard BASIS_POINTS against zero before APR division - Use total TVL (staking + subscriptions) for visibility threshold - Only add rewardTokens/apyReward when reward APY > 0 - Clean up BigInt comparisons to use 0n literals * fix pool IDs to use asset address, remove inflated staking TVL, simplify poolMeta - Pool IDs now use asset address instead of symbol for stability - Remove CreatorBid subscription TVL from staking pool (different mechanism) - Simplify poolMeta to '6M / 12M lock' (APR already in apyReward) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * shorten vault pool IDs to surf-{asset}-{chain} Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: kr3p <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
* add stakeTHENA * enable timetravel * enable timetravel --------- Co-authored-by: root <[email protected]>
Adapter recorded Morpho's instantaneous netApy, which briefly spikes when underlying markets hit ~100% utilization. Switch to avgNetApy(lookback: ONE_DAY) for both base and net, and drop pools whose 1d-realized reading exceeds 200% — broken liquidity adapters return constant 1000%+ values across every Morpho field. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
* feat(mezo-earn): add adapter * axios instead of superagent.. * fixes
morpho-blue: use 1d-realized APY and drop spike snapshots
…um USDC) (#2678) * feat: add ScrubVault yield pools to scrub project (Kava USDt + Arbitrum USDC) Adds a yield adapter under src/adaptors/scrub/ tracking the two ScrubVault DepositVault pools, reusing the existing scrub protocol slug. ScrubVault is a delta-neutral managed vault. Users deposit USDt (Kava) or USDC (Arbitrum) and receive share tokens. Capital is deployed off-chain across CEXs and DEXs running a delta-neutral funding-rate and market-making strategy. Because funds are actively managed off-chain the vault contract holds only unprocessed pending deposits. The on-chain totalVaultValue variable is the authoritative AUM figure, updated via distributeRewards() each time PnL is settled back to the vault. TVL and APY here reflect assets under management, not tokens sitting in the contract. APY methodology: - Kava pool: rolling 30-day APR read from the live Kava subgraph (apr field in basis-points x100), falling back to on-chain RewardDistributed event computation if subgraph is unavailable. - Arbitrum pool: APR computed from RewardDistributed events via eth_getLogs, annualised over a 30-day window. Returns 0 until reward history accumulates. Pools: - 0x7bff6c730da681df03364c955b165576186370bc-kava (USDt, Kava) - 0x439a923517c4dfd3f3d0abb0c36e356d39cf3f9d-arbitrum (USDC, Arbitrum) * fix: correct vault URL to https://invest.scrub.money/ * refactor: address PR review comments - use SDK for getLogs, finite APR guard, dynamic URL * feat(scrub): daily APR from RewardDistributed events via SDK getLogs - Drop 30-day rolling APY approach - Compute APR from single most-recent daily RewardDistributed event formula: rewardAmount / prevTVL * 365 * 100 - Use sdk.api.util.getLogs for both chains (no axios) - Kava: 3-day window split into 5 parallel 10k-block SDK calls (Kava RPC caps eth_getLogs at 10k blocks per request) - Kava latest block via ethers.providers.JsonRpcProvider (sdk.api.util.getLatestBlock does not support Kava) - Arbitrum: single getLogs call; sdk.api.util.getLatestBlock works fine - Verified live: Kava TVL=$55,590 APY=15%, Arb TVL=$6,770 APY=15% * fix(scrub): address PR review — rolling-window APR, safe BigNumber math, per-vault error handling - Sum RewardDistributed events over the full 3-day window instead of taking the most recent positive event, so loss days reduce the reported APR and the figure reflects true rolling return. - Replace BigNumber.toNumber() with ethers.utils.formatUnits to avoid Number.MAX_SAFE_INTEGER overflow on large balances. - Wrap each vault iteration in try/catch so an RPC outage on one chain does not block the other chain's pool from being reported. Verified live: Kava USDt $82,777 @ 15.10% APR, Arbitrum USDC $31,784 @ 15.00% APR. * fix(scrub): overflow-safe TVL and propagate getLogs errors - fetchTvlUsd now uses ethers.utils.formatUnits instead of Number(output) / 10**decimals — same overflow safety as the APR path. - Drop the inner .catch in fetchRewardLogs so RPC/SDK failures propagate to the per-vault try/catch in apy(). Previously, a network failure was indistinguishable from "no rewards" and the vault was emitted with apyBase: 0 instead of being skipped. Verified live: Kava USDt $82,777 @ 15.10% APR, Arbitrum USDC $31,784 @ 15.00% APR. * feat(scrub): add pricePerShare field from on-chain shareValue() Addresses PR review request (@0xkr3p): include the vault share price. - New SHARE_VALUE_ABI + fetchPricePerShare() reads the vault's shareValue() view, which returns USD value of one share in 18 decimals regardless of the stablecoin's decimals. - pricePerShare fetched in parallel with TVL and reward logs, added to each pool's output (rounded to 6 dp). Verified live via SDK: Kava 1.038094, Arbitrum 1.020358. * refactor(scrub): use sdk.api.util.getLatestBlock for all chains Addresses PR review (@0xkr3p): sdk.api.util.getLatestBlock supports Kava, so the ethers JsonRpcProvider fallback and per-vault rpcUrl config are unnecessary. - Remove getLatestBlockNumber helper; call sdk.api.util.getLatestBlock (chainKey) directly at the single call site. - Drop the now-unused rpcUrl field from both vault configs. - Update header docstring accordingly. ethers is still required for Interface/BigNumber/formatUnits. * refactor(scrub): use sdk.getEventLogs with event ABI Addresses PR review (@0xkr3p): switch from sdk.api.util.getLogs with a manual topic filter to sdk.getEventLogs with the event ABI, matching the pattern used across the codebase (aloe, smardex, ethena, etc.). - Replace ethers Interface/topic/parseLog with REWARD_EVENT_ABI string; sdk.getEventLogs returns logs pre-decoded into .args. - computeDailyApr now consumes the decoded BigInt args directly and uses native BigInt math (no ethers.BigNumber). - Kava 10k-block chunking and error-propagation behaviour unchanged. Verified live on @defillama/sdk 5.0.209: Kava USDt $82,913 @ 15% pps 1.038094, Arbitrum USDC $32,461 @ 15% pps 1.020358 — identical to the pre-refactor output. * refactor(scrub): return raw apyBase and pricePerShare Addresses PR review (@0xkr3p): drop Math.round on apyBase and pricePerShare — return the raw computed values; DefiLlama handles display rounding. Live: Kava 14.9962% pps 1.03809392, Arbitrum 14.9958% pps 1.02035828. --------- Co-authored-by: theg <> Co-authored-by: TheG <[email protected]>
borrow token batch1
… category (#2694) * refactor(scrubvault): publish under scrubvault slug for Basis Trading Follow-up to #2678 (merged). The pools were mapping to the "Scrub" protocol (category Algo-Stables) because the adapter used project 'scrub'. The delta-neutral vaults belong to the separately-registered "ScrubVault" protocol, which DefiLlama already categorizes as Basis Trading (chains Kava + Arbitrum). - git mv src/adaptors/scrub -> src/adaptors/scrubvault - PROJECT 'scrub' -> 'scrubvault' Satisfies test.js project==adapterName and known-slug checks. Verified live: both pools return, APR ~15%, pps 1.0381 / 1.0204. * fix(scrubvault): use PROJECT constant in error log prefix Addresses CodeRabbit review on #2694: the per-vault error log still hardcoded "[scrub]"; use `[${PROJECT}]` so the prefix tracks the slug constant and stays consistent. --------- Co-authored-by: TheG <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.