Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "../../types/index.js";

import {
type FetchParameters,
type DeploylessFetchParameters,
blueAbi,
fetchToken,
} from "@morpho-org/blue-sdk-viem";
Expand All @@ -29,7 +29,7 @@ import { rateToApy } from "../../utils/rates.js";
export async function fetchAaveV2Positions(
user: Address,
client: Client,
parameters: FetchParameters = {},
{ deployless = true, ...parameters }: DeploylessFetchParameters = {},
): Promise<MigratablePosition[]> {
parameters.chainId ??= await getChainId(client);

Expand Down Expand Up @@ -129,7 +129,7 @@ export async function fetchAaveV2Positions(
functionName: "_nonces",
args: [user],
}),
fetchToken(tokenAddress, client, parameters),
fetchToken(tokenAddress, client, { deployless, ...parameters }),
]);

const userReserveConfig = userConfigByToken[underlyingAddress];
Expand Down Expand Up @@ -177,7 +177,7 @@ export async function fetchAaveV2Positions(
functionName: "getReserveData",
args: [underlyingAddress],
}),
fetchToken(underlyingAddress, client, parameters),
fetchToken(underlyingAddress, client, { deployless, ...parameters }),
]);

const [totalBorrow, morphoNonce, isBundlerManaging] = await Promise.all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type Address, MathLib, getChainAddresses } from "@morpho-org/blue-sdk";
import { isDefined, values } from "@morpho-org/morpho-ts";

import {
type FetchParameters,
type DeploylessFetchParameters,
blueAbi,
fetchToken,
} from "@morpho-org/blue-sdk-viem";
Expand All @@ -29,7 +29,7 @@ import { rateToApy } from "../../utils/rates.js";
export async function fetchAaveV3Positions(
user: Address,
client: Client,
parameters: FetchParameters = {},
{ deployless = true, ...parameters }: DeploylessFetchParameters = {},
): Promise<MigratablePosition[]> {
parameters.chainId ??= await getChainId(client);

Expand Down Expand Up @@ -128,7 +128,7 @@ export async function fetchAaveV3Positions(
functionName: "nonces",
args: [user],
}),
fetchToken(tokenAddress, client, parameters),
fetchToken(tokenAddress, client, { deployless, ...parameters }),
]);

const userReserveConfig = userConfigByToken[underlyingAddress];
Expand Down Expand Up @@ -183,7 +183,7 @@ export async function fetchAaveV3Positions(
functionName: "getReserveEModeCategory",
args: [underlyingAddress],
}).catch(() => null),
fetchToken(underlyingAddress, client, parameters),
fetchToken(underlyingAddress, client, { deployless, ...parameters }),
]);

const [totalBorrow, eModeCategoryData, morphoNonce, isBundlerManaging] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type Address, getChainAddresses } from "@morpho-org/blue-sdk";
import { isDefined, values } from "@morpho-org/morpho-ts";

import {
type FetchParameters,
type DeploylessFetchParameters,
blueAbi,
fetchToken,
} from "@morpho-org/blue-sdk-viem";
Expand All @@ -24,7 +24,7 @@ async function fetchCompoundV3InstancePosition(
user: Address,
cometAddress: Address,
client: Client,
parameters: FetchParameters = {},
{ deployless = true, ...parameters }: DeploylessFetchParameters = {},
) {
parameters.chainId ??= await getChainId(client);

Expand Down Expand Up @@ -226,8 +226,8 @@ async function fetchCompoundV3InstancePosition(
functionName: "isSupplyPaused",
args: [],
}),
fetchToken(baseToken, client, parameters),
fetchToken(assetInInfo.asset, client, parameters),
fetchToken(baseToken, client, { deployless, ...parameters }),
fetchToken(assetInInfo.asset, client, { deployless, ...parameters }),
]);

/* MAX */
Expand Down Expand Up @@ -316,7 +316,7 @@ async function fetchCompoundV3InstancePosition(
export async function fetchCompoundV3Positions(
user: Address,
client: Client,
parameters: FetchParameters = {},
{ deployless = true, ...parameters }: DeploylessFetchParameters = {},
): Promise<MigratablePosition[]> {
parameters.chainId ??= await getChainId(client);

Expand All @@ -330,12 +330,10 @@ export async function fetchCompoundV3Positions(
return (
await Promise.all(
values(migrationContracts).map(({ address: cometAddress }) =>
fetchCompoundV3InstancePosition(
user,
cometAddress,
client,
parameters,
).catch(() => null),
fetchCompoundV3InstancePosition(user, cometAddress, client, {
deployless,
...parameters,
}).catch(() => null),
),
)
).filter(isDefined);
Expand Down
4 changes: 2 additions & 2 deletions packages/migration-sdk-viem/src/fetchers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Address } from "@morpho-org/blue-sdk";
import type { MigratablePosition } from "../positions/index.js";
import { MigratableProtocol } from "../types/index.js";

import type { FetchParameters } from "@morpho-org/blue-sdk-viem";
import type { DeploylessFetchParameters } from "@morpho-org/blue-sdk-viem";
import { fromEntries } from "@morpho-org/morpho-ts";
import type { Client } from "viem";
import { fetchAaveV2Positions } from "./aaveV2/aaveV2.fetchers.js";
Expand Down Expand Up @@ -59,7 +59,7 @@ export async function fetchMigratablePositions(
MigratableProtocol.compoundV2,
],
}: {
parameters?: FetchParameters;
parameters?: DeploylessFetchParameters;
protocols?: MigratableProtocol[];
} = {},
): Promise<{
Expand Down