Merging updates from defillama#3
Open
iagoLD wants to merge 6428 commits into
Open
Conversation
use lp address for pool value
* arche: add Metrom incentive APY * arche: add timeout to Metrom request --------- Co-authored-by: yieldarche <275474729+yieldarche@users.noreply.github.com>
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) <noreply@anthropic.com>
* 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 <theg@gmail.com>
borrow token batch1
* feat(btcd): sBTCD yield pool adapter Pure on-chain ERC4626 share-price-growth adapter for the BTCD staking vault (sBTCD). Reads sBTCD.totalSupply for size, the on-chain SBTCDOracle (Chainlink-compatible, 8 decimals USD) for tvlUsd, and 7d share-price growth via convertToAssets(1e18) at current and historical blocks for apyBase. Single pool, no rewards (yield is auto-compounded into the share price via 8h linear vesting from the YieldDistributor). underlyingTokens = BTCD; pool id lowercased per yield-server convention. Note: the upstream PR is gated on BTCD being listed on DefiLlama's TVL page (DefiLlama-Adapters). Holding the merge here until that lands. * feat(btcd): update computeApyBase function for improved historical block handling * feat(btcd): enhance documentation and add new adapter entry point for sBTCD yield pool * feat(btcd): improve TVL calculation precision and clarify comments in apy function * feat(btcd): streamline comments and improve code readability in sBTCD adapter * feat(btcd): replace WAD with SCALE for consistency in APY calculations and update variable names for clarity * feat(btcd): remove cooldown mention from poolMeta in BTCD staking vault * feat(btcd): enhance sBTCD adapter with vesting and cooldown duration in poolMeta * feat(btcd): add detailed JSDoc comments for functions in sBTCD adapter * feat(btcd): add JSDoc comments for module export and file description in sBTCD adapter * fix(btcd): format cooldownDurationAbi declaration for consistency * fix(btcd): add validation checks for latest and old data in computeApyBase function * fix(btcd): update computeApyBase to return null on errors and adjust apy structure to handle null values
* Add SpringX's info to the Yields adapter * Code optimization --------- Co-authored-by: springx <team@springx.finance>
This PR aligns the Credit adapter with the schema documented in the yield-server README for lending protocols:
> `tvlUsd: number; // for lending protocols: tvlUsd = totalSupplyUsd - totalBorrowUsd`
The current adapter sets `tvlUsd` to the full `totalAssets()` value of the vault, which represents the supply side rather than the available liquidity. Since the adapter already reads `totalOutstandingPrincipal()` for its utilization calculation, we can populate the dedicated `totalSupplyUsd` and `totalBorrowUsd` fields and let `tvlUsd` reflect the available liquidity, so the breakdown matches what is shown for other lending pools (Aave, Compound, Morpho, etc.).
## Changes
- `tvlUsd` is now `(totalAssets − totalOutstandingPrincipal) * price`
(available liquidity).
- New `totalSupplyUsd = totalAssets * price`.
- New `totalBorrowUsd = totalOutstandingPrincipal * price`.
- A `Math.max(..., 0)` guard is added on the available-liquidity computation to absorb any transient case where 'totalOutstanding` briefly exceeds `totalAssets` due to accrued-but-unrealized interest.
- APY calculation, utilization rate, and ABIs are unchanged.
* azuro: read net APY/TVL from Dune snapshot * azuro: keep legacy pool id, shorten poolMeta
* origami-finance: call origami server vault-apy endpoint * added axios timeout + switch to Promise.allSettled * update to calculate tvl from onchain * throw on unsupported vault_kinds + remove error catching on vaultKindTvl * update to Promise.allSettled in apy()
* accountable: fix NAV vault APY (use annualized APY from API) * accountable: omit null supply/borrow, include point names in rewardTokens * accountable: null apyReward when rewardTokens empty (invariant guard) * ci: re-run accountable adapter checks * fix(accountable): use 7d/30d net APY for apyBase, drop since-inception * fix(accountable): batch + retry per-loan fetches to avoid 503 gaps * revert: drop per-loan batching/retry * fix(accountable): resolve vault + underlying on-chain to fix undefined fields * fix(accountable): drop points from apyReward, surface via poolMeta --------- Co-authored-by: pawel-accountable <282215858+pawel-accountable@users.noreply.github.com>
* feat: add everything pool apy * fix(everything): correct S3 bucket URL * fix: handle copilot finding * feat: use defillama sdk * feat: paginate swap fetching to avoid 1000-result cap * fix: skip farming campaigns that haven't started yet * fix: log swap query failures instead of silently zeroing apyBase * refactor(everything): remove dead fee-fetch code, harden chain fetching * feat: add ethereum pools * fix: remove formatSymbol call * fix: report apyBase as null when swap query fails --------- Co-authored-by: Alfred GAILLARD <a.gaillard@ra2.tech> Co-authored-by: cedric <c.ogire@ra2.tech>
* chore: rename symbols ton -> gram * more
* fix 3jane tvl and apy * use usdc price for tvl
* Add Cube DEX yield adapter * review: drop formatSymbol + harden underlyingTokens Per @0xkr3p review: - adapters no longer use utils.formatSymbol — pass symbol through verbatim - defensive Array.isArray guard on underlyingTokens before emitting --------- Co-authored-by: sepezho <evaaprotocol@gmail.com>
support pro price API routing in adapters
Add protocolId exports to yield adapter
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.