diff --git a/packages/blue-sdk-ethers/test/e2e/setup.ts b/packages/blue-sdk-ethers/test/e2e/setup.ts index 4d8321d9..435c2dc2 100644 --- a/packages/blue-sdk-ethers/test/e2e/setup.ts +++ b/packages/blue-sdk-ethers/test/e2e/setup.ts @@ -1,11 +1,17 @@ import { createEthersTest } from "@morpho-org/test/vitest/ethers"; import { mainnet } from "viem/chains"; +/** + * This test will run on `mainnet` forked at block `19,530,000`. + */ export const test = createEthersTest(mainnet, { forkUrl: process.env.MAINNET_RPC_URL, forkBlockNumber: 19_530_000, }); +/** + * This test will run on `mainnet` forked at block `21,595,000`. + */ export const test2 = createEthersTest(mainnet, { forkUrl: process.env.MAINNET_RPC_URL, forkBlockNumber: 21_595_000, diff --git a/packages/blue-sdk-viem/test/setup.ts b/packages/blue-sdk-viem/test/setup.ts index cf5849d5..c7af61ec 100644 --- a/packages/blue-sdk-viem/test/setup.ts +++ b/packages/blue-sdk-viem/test/setup.ts @@ -1,11 +1,17 @@ import { createViemTest } from "@morpho-org/test/vitest"; import { mainnet } from "viem/chains"; +/** + * This test will run on `mainnet` forked at block `19,530,000`. + */ export const test = createViemTest(mainnet, { forkUrl: process.env.MAINNET_RPC_URL, forkBlockNumber: 19_530_000, }); +/** + * This test will run on `mainnet` forked at block `21,595,000`. + */ export const test2 = createViemTest(mainnet, { forkUrl: process.env.MAINNET_RPC_URL, forkBlockNumber: 21_595_000, diff --git a/packages/blue-sdk/src/position/Position.ts b/packages/blue-sdk/src/position/Position.ts index 8914ba51..1d94133e 100644 --- a/packages/blue-sdk/src/position/Position.ts +++ b/packages/blue-sdk/src/position/Position.ts @@ -172,10 +172,34 @@ export class AccrualPosition extends Position implements IAccrualPosition { return this.market.getBorrowCapacityUsage(this); } + /** + * Returns the maximum amount of loan assets that can be borrowed given a certain borrow position + * and the reason for the limit. + * Returns `undefined` iff the market's price is undefined. + * @deprecated Use `getBorrowCapacityLimit` instead. + */ + get borrowCapacityLimit() { + return this.market.getBorrowCapacityLimit(this); + } + + /** + * Returns the maximum amount of loan assets that can be withdrawn given a certain supply position + * and a balance of loan assets, and the reason for the limit. + */ get withdrawCapacityLimit() { return this.market.getWithdrawCapacityLimit(this); } + /** + * Returns the maximum amount of collateral assets that can be withdrawn given a certain borrow position + * and the reason for the limit. + * Returns `undefined` iff the market's price is undefined. + * @deprecated Use `getWithdrawCollateralCapacityLimit` instead. + */ + get withdrawCollateralCapacityLimit() { + return this.market.getWithdrawCollateralCapacityLimit(this); + } + /** * Returns a new position derived from this position, whose interest has been accrued up to the given timestamp. * @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to the market's `lastUpdate`.