feat: add POK Vault yield adapter#2291
Conversation
📝 WalkthroughWalkthroughAdds a new adaptor module at Changes
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 }]
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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
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 |
|
The pok-vault adapter exports pools: Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
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
sdkimport 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 ofhttps://. Since the site supports HTTPS, prefer it for better security.🔒 Suggested fix
- url: 'http://pokvault.xyz/', + url: 'https://pokvault.xyz/',
| 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]}]; |
There was a problem hiding this comment.
🧩 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 -10Repository: 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 jsRepository: 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.jsRepository: 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 -30Repository: 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 "---"
doneRepository: 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 -A3Repository: 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).
There was a problem hiding this comment.
Invalid:
This is the underlying token and it has 18 decimals
There was a problem hiding this comment.
🧩 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.
|
The pok-vault adapter exports pools: Test Suites: 1 passed, 1 total |
|
pls check the adapter output (both tvl and apy) |
|
Closing this for now. I will re-open the PR when we launch a new vault. Thanks. |

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