Skip to content

Commit

Permalink
Merge pull request #151 from layerbankgoldsky/layerbank
Browse files Browse the repository at this point in the history
fix: underlying addr type
  • Loading branch information
nitish-91 authored May 22, 2024
2 parents d1e1b2d + 7bce57b commit de73d1b
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions adapters/layerbank/src/sdk/marketDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,20 @@ export const getMarketInfos = async (

const underlyingAddresses = underlyingResults
.map((v) => v.result as `0x${string}`)
.map((m) => m.toLowerCase());
.map((m) => {
if (m === "0x0000000000000000000000000000000000000000") {
return "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f";
} else {
return m.toLowerCase();
}
});

const underlyings = underlyingAddresses.map((m) => {
if (m === "0x0000000000000000000000000000000000000000") {
return getContract({
address: "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
abi: ltokenAbi,
client: publicClient,
});
} else {
return getContract({
address: m,
abi: ltokenAbi,
client: publicClient,
});
}
getContract({
address: m as `0x${string}`,
abi: ltokenAbi,
client: publicClient,
});
});

const underlyingSymbolResults = await publicClient.multicall({
Expand All @@ -85,7 +83,7 @@ export const getMarketInfos = async (

for (let i = 0; i < markets.length; i++) {
const marketAddress = markets[i].address.toLowerCase();
const underlyingAddress = underlyingResults[i].result?.toLowerCase();
const underlyingAddress = underlyingAddresses[i];

marketInfos.push({
address: marketAddress,
Expand Down

0 comments on commit de73d1b

Please sign in to comment.