Skip to content

Commit e2baaf0

Browse files
authored
add correct symbol for edge cases in hold tokens (#2460)
1 parent dcc4cac commit e2baaf0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/adaptors/merkl/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,28 @@ const main = async () => {
147147
).output;
148148
}
149149

150+
// For HOLD pools where the pool address (vault) isn't in the tokens list,
151+
// the symbol may reflect the underlying rather than the vault itself.
152+
// Resolve the vault's on-chain symbol for accurate representation.
153+
const tokenAddresses = new Set(
154+
pool.tokens.map((t) => t.address.toLowerCase())
155+
);
156+
if (
157+
pool.action === 'HOLD' &&
158+
!tokenAddresses.has(poolAddress.toLowerCase())
159+
) {
160+
try {
161+
const vaultSymbol = (
162+
await sdk.api.abi.call({
163+
target: poolAddress,
164+
chain,
165+
abi: 'erc20:symbol',
166+
})
167+
).output;
168+
if (vaultSymbol) symbol = vaultSymbol;
169+
} catch {}
170+
}
171+
150172
let underlyingTokens = getUnderlyingTokens(pool);
151173

152174
// For ERC-4626 vault pools where the only underlying is the vault itself,

0 commit comments

Comments
 (0)