Skip to content

feat: add POK Vault yield adapter#2291

Merged
slasher125 merged 3 commits intoDefiLlama:masterfrom
yashnaman:add-pok-vault-adapter
Feb 24, 2026
Merged

feat: add POK Vault yield adapter#2291
slasher125 merged 3 commits intoDefiLlama:masterfrom
yashnaman:add-pok-vault-adapter

Conversation

@yashnaman
Copy link
Contributor

@yashnaman yashnaman commented Jan 24, 2026

Summary by CodeRabbit

  • New Features
    • Integrates POK vault: displays POK‑USDT APY and TVL (USD), reports underlying USDT token, provides historical timestamped metrics on BSC, and includes a direct link to the project site (https://pokvault.xyz/).

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Adds a new adaptor module at src/adaptors/pok-vault/index.js that implements an async apy(timestamp) function calling a local utils.getERC4626Info on BSC to fetch vault info and returns a formatted object with TVL, underlying token, and vault metadata. Exports timetravel and url.

Changes

Cohort / File(s) Summary
POK Vault Adaptor
src/adaptors/pok-vault/index.js
New adaptor implementing apy(timestamp) which calls utils.getERC4626Info(POK_VAULT_ADDRESS, 'bsc', timestamp), formats tvl via ethers.utils.formatEther, merges pokVaultInfo, returns a single-item array with project/symbol/tvlUsd/underlyingTokens. Exports timetravel: true and url.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as Client
    participant Adaptor as POK Vault Adaptor
    participant Utils as utils.getERC4626Info
    participant Chain as BSC (via ethers)

    Caller->>Adaptor: apy(timestamp)
    Adaptor->>Utils: getERC4626Info(POK_VAULT_ADDRESS, 'bsc', timestamp)
    Utils->>Chain: read ERC4626 contract state (via ethers)
    Chain-->>Utils: vault data (tvl, metadata)
    Utils-->>Adaptor: { tvl, pokVaultInfo }
    Adaptor-->>Caller: [{ project, symbol, tvlUsd, underlyingTokens, ...pokVaultInfo }]
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped to a vault with POK and delight,
I fetched its TVL by moonlit night,
I wrapped it in JSON, tidy and neat,
USDT tucked in, steady and sweet,
Hooray — a new adaptor, light on its feet!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: adding a new POK Vault yield adapter module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@llamatester
Copy link

The pok-vault adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 10 passed, 10 total
Snapshots: 0 total
Time: 0.246 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬──────────────────────────────────────────────┬───────┬─────────────────────┬─────────────┬────────────┬────────────────────┬──────────────────────────────────────────────────┐
│ (index) │ pool                                         │ chain │ apyBase             │ project     │ symbol     │ tvlUsd             │ underlyingTokens                                 │
├─────────┼──────────────────────────────────────────────┼───────┼─────────────────────┼─────────────┼────────────┼────────────────────┼──────────────────────────────────────────────────┤
│ 0       │ '0x5a791CCAB49931861056365eBC072653F3FA0ba0' │ 'bsc' │ -0.2519082297434636 │ 'pok-vault' │ 'POK-USDT' │ 103.19797567519913 │ [ '0x55d398326f99059fF775485246999027B3197955' ] │
└─────────┴──────────────────────────────────────────────┴───────┴─────────────────────┴─────────────┴────────────┴────────────────────┴──────────────────────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Copy link

@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

🤖 Fix all issues with AI agents
In `@src/adaptors/pok-vault/index.js`:
- Around line 9-11: The TVL is being formatted with ethers.utils.formatEther
(which divides by 1e18) but the vault uses USDT with 6 decimals; in the return
object that builds pokVaultInfo (using getERC4626Info and POK_VAULT_ADDRESS)
replace the ethers.utils.formatEther(tvl) usage with dividing tvl by 1e6 so
tvlUsd is Number(tvl / 1e6) (keep the rest of the returned fields like project:
'pok-vault', symbol: 'POK-USDT', and underlyingTokens: [USDT_ADDRESS]
unchanged).
🧹 Nitpick comments (2)
src/adaptors/pok-vault/index.js (2)

1-1: Remove unused import.

The sdk import is never used in this file.

🧹 Suggested fix
-const sdk = require('@defillama/sdk');
 const ethers = require('ethers');
 const utils = require('../utils');

17-17: Consider using HTTPS for the URL.

The URL uses http:// instead of https://. Since the site supports HTTPS, prefer it for better security.

🔒 Suggested fix
-    url: 'http://pokvault.xyz/',
+    url: 'https://pokvault.xyz/',

Comment on lines +9 to +11
const {tvl, ...pokVaultInfo} = await utils.getERC4626Info(POK_VAULT_ADDRESS, 'bsc', timestamp);

return [{... pokVaultInfo, project: 'pok-vault', symbol: 'POK-USDT', tvlUsd: Number(ethers.utils.formatEther(tvl)), underlyingTokens: [USDT_ADDRESS]}];
Copy link

@coderabbitai coderabbitai bot Jan 24, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find getERC4626Info implementation and usage patterns

# 1. Check utils for getERC4626Info definition
echo "=== Searching for getERC4626Info implementation ==="
rg -n "getERC4626Info" src/ -t js --type-list | head -20

# Find which file contains the utils
fd -t f -n "*.js" -path "*/utils*" src/ | head -10

Repository: DefiLlama/yield-server

Length of output: 755


🏁 Script executed:

#!/bin/bash
# Search for getERC4626Info in more detail
find src -name "*.js" -type f -exec rg -l "getERC4626Info" {} \;

Repository: DefiLlama/yield-server

Length of output: 531


🏁 Script executed:

#!/bin/bash
# Get the implementation of getERC4626Info
rg -n -A 30 "function getERC4626Info|const getERC4626Info|exports.getERC4626Info" src/ -t js

Repository: DefiLlama/yield-server

Length of output: 3906


🏁 Script executed:

#!/bin/bash
# Get the full getERC4626Info function implementation
rg -n -A 80 "^exports.getERC4626Info = async" src/adaptors/utils.js

Repository: DefiLlama/yield-server

Length of output: 2360


🏁 Script executed:

#!/bin/bash
# Also check how tvl is used in other adapters after getERC4626Info
rg -n -B2 -A10 "getERC4626Info" src/adaptors/40-acres/index.js | head -30

Repository: DefiLlama/yield-server

Length of output: 456


🏁 Script executed:

#!/bin/bash
# Check all adapters using getERC4626Info and how they format tvl
echo "=== All getERC4626Info usages ==="
for file in $(rg -l "getERC4626Info" src/adaptors/ --type js); do
  echo "File: $file"
  rg -B1 -A8 "getERC4626Info" "$file"
  echo "---"
done

Repository: DefiLlama/yield-server

Length of output: 7781


🏁 Script executed:

#!/bin/bash
# Check if formatEther is used elsewhere with getERC4626Info
rg -n "formatEther" src/adaptors/ --type js -B3 -A3

Repository: DefiLlama/yield-server

Length of output: 28335


Fix TVL decimal formatting—use 1e6 divisor instead of formatEther for USDT.

ethers.utils.formatEther() divides by 10^18, but USDT on BSC has 6 decimals. The code should divide TVL by 1e6 instead, matching the pattern used in other adapters (e.g., 40-acres uses tvl / 1e6). Without this fix, TVL will be understated by a factor of 10^12.

tvlUsd: Number(tvl / 1e6)
🤖 Prompt for AI Agents
In `@src/adaptors/pok-vault/index.js` around lines 9 - 11, The TVL is being
formatted with ethers.utils.formatEther (which divides by 1e18) but the vault
uses USDT with 6 decimals; in the return object that builds pokVaultInfo (using
getERC4626Info and POK_VAULT_ADDRESS) replace the ethers.utils.formatEther(tvl)
usage with dividing tvl by 1e6 so tvlUsd is Number(tvl / 1e6) (keep the rest of
the returned fields like project: 'pok-vault', symbol: 'POK-USDT', and
underlyingTokens: [USDT_ADDRESS] unchanged).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Invalid:
This is the underlying token and it has 18 decimals

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

🌐 Web query:

BSC token 0x55d398326f99059fF775485246999027B3197955 decimals

💡 Result:

The BSC token at 0x55d398326f99059fF775485246999027B3197955 (Binance-Peg BSC-USD / USDT) uses 18 decimals. [1][2]


@yashnaman, you're absolutely right—I apologize for the incorrect review. The web search confirms that the Binance-Peg BSC-USD token at 0x55d398326f99059fF775485246999027B3197955 on BSC uses 18 decimals, so ethers.utils.formatEther() is the correct approach. The current implementation is correct as-is.


✏️ Learnings added
Learnt from: yashnaman
Repo: DefiLlama/yield-server PR: 2291
File: src/adaptors/pok-vault/index.js:8-10
Timestamp: 2026-01-24T05:28:12.918Z
Learning: The Binance-Peg BSC-USD / USDT token at address 0x55d398326f99059fF775485246999027B3197955 on BSC chain has 18 decimals, not the typical 6 decimals that USDT uses on some other chains.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@llamatester
Copy link

The pok-vault adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 10 passed, 10 total
Snapshots: 0 total
Time: 0.252 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬──────────────────────────────────────────────┬───────┬─────────────────────┬─────────────┬────────────┬────────────────────┬──────────────────────────────────────────────────┐
│ (index) │ pool                                         │ chain │ apyBase             │ project     │ symbol     │ tvlUsd             │ underlyingTokens                                 │
├─────────┼──────────────────────────────────────────────┼───────┼─────────────────────┼─────────────┼────────────┼────────────────────┼──────────────────────────────────────────────────┤
│ 0       │ '0x5a791CCAB49931861056365eBC072653F3FA0ba0' │ 'bsc' │ -0.2548310785260526 │ 'pok-vault' │ 'POK-USDT' │ 103.19797601670278 │ [ '0x55d398326f99059fF775485246999027B3197955' ] │
└─────────┴──────────────────────────────────────────────┴───────┴─────────────────────┴─────────────┴────────────┴────────────────────┴──────────────────────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@slasher125
Copy link
Collaborator

@yashnaman

pls check the adapter output (both tvl and apy)

@yashnaman
Copy link
Contributor Author

Closing this for now. I will re-open the PR when we launch a new vault. Thanks.

@yashnaman yashnaman closed this Jan 26, 2026
@yashnaman yashnaman reopened this Feb 12, 2026
@yashnaman
Copy link
Contributor Author

yashnaman commented Feb 12, 2026

@yashnaman

pls check the adapter output (both tvl and apy)

I have re-opened the PR now that the vault has more TVL. Please take a look again. Thanks

image

@slasher125 slasher125 merged commit a1c632f into DefiLlama:master Feb 24, 2026
2 of 3 checks passed
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.

3 participants