@morpho-org/morpho-test 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@ const morpho_ts_1 = require("@morpho-org/morpho-ts");
7
7
  const viem_1 = require("viem");
8
8
  const asset_js_1 = require("./asset.js");
9
9
  const setup_js_1 = require("./setup.js");
10
+ const collateralToken = "0xE2e0000000000000000000000000000000000004";
10
11
  /** Fork addresses of the named E2E wallets. */
11
12
  exports.E2E_MIDNIGHT_WALLETS = {
12
13
  A: "0x00000000000000000000000000000000e2E0000A",
@@ -28,7 +29,6 @@ const createE2eMidnightMarket = async (client, chainId, options = {}) => {
28
29
  const midnight = (0, morpho_ts_1.getChainAddress)(chainId, "midnight");
29
30
  const loanAsset = (0, asset_js_1.getE2eAsset)(chainId);
30
31
  const loanToken = loanAsset.address.toLowerCase();
31
- const collateralToken = "0xE2e0000000000000000000000000000000000004";
32
32
  if (loanAsset.requiresInstall)
33
33
  await (0, setup_js_1.installE2eAsset)(client, loanToken);
34
34
  await (0, setup_js_1.installE2eAsset)(client, collateralToken);
@@ -114,6 +114,12 @@ const fundE2eMidnightWallets = async (client, params) => {
114
114
  account,
115
115
  amount: balanceBefore + amount,
116
116
  });
117
+ if ((0, viem_1.isAddressEqual)(token, collateralToken) &&
118
+ (await client.getCode({ address: token })) === asset_js_1.E2E_ASSET_BYTECODE)
119
+ await client.setBalance({
120
+ address: token,
121
+ value: (await client.getBalance({ address: token })) + amount,
122
+ });
117
123
  }
118
124
  (0, node_assert_1.strictEqual)(await client.readContract({
119
125
  address: token,
@@ -67,6 +67,13 @@ const wrapE2eNative = async (client, params) => {
67
67
  amount: (await client.balanceOf({ erc20: params.wNative, owner: account })) +
68
68
  params.amount,
69
69
  });
70
+ if ((0, viem_1.isAddressEqual)(params.wNative, (0, asset_js_1.getE2eAsset)(client.chain.id).address) &&
71
+ (await client.getCode({ address: params.wNative })) === asset_js_1.E2E_ASSET_BYTECODE)
72
+ await client.setBalance({
73
+ address: params.wNative,
74
+ value: (await client.getBalance({ address: params.wNative })) +
75
+ params.amount,
76
+ });
70
77
  return;
71
78
  }
72
79
  if (params.account == null) {
@@ -8,7 +8,6 @@ exports.withSimplePermit = {
8
8
  blue_sdk_1.addressesRegistry[blue_sdk_1.ChainId.EthMainnet].sDai,
9
9
  blue_sdk_1.addressesRegistry[blue_sdk_1.ChainId.EthMainnet].osEth,
10
10
  blue_sdk_1.addressesRegistry[blue_sdk_1.ChainId.EthMainnet].usdc,
11
- blue_sdk_1.addressesRegistry[blue_sdk_1.ChainId.EthMainnet].dai,
12
11
  ]),
13
12
  [blue_sdk_1.ChainId.BaseMainnet]: new Set([
14
13
  blue_sdk_1.addressesRegistry[blue_sdk_1.ChainId.BaseMainnet].usdc,
@@ -32,7 +32,7 @@ exports.vaults = {
32
32
  decimalsOffset: 12n,
33
33
  symbol: "bbUSDC",
34
34
  name: "BlockAnalytica USDC",
35
- asset: wNative,
35
+ asset: usdc,
36
36
  }),
37
37
  bbEth: new blue_sdk_1.VaultConfig({
38
38
  address: "0x38989BBA00BDF8181F4082995b3DEAe96163aC5D",
@@ -1,2 +1,3 @@
1
1
  export * from "./e2e/index.js";
2
2
  export * from "./fixtures/index.js";
3
+ export { version } from "./version.js";
package/lib/cjs/index.js CHANGED
@@ -14,5 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.version = void 0;
17
18
  __exportStar(require("./e2e/index.js"), exports);
18
19
  __exportStar(require("./fixtures/index.js"), exports);
20
+ var version_js_1 = require("./version.js");
21
+ Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_js_1.version; } });
@@ -0,0 +1,2 @@
1
+ /** Installed @morpho-org/morpho-test package version. */
2
+ export declare const version = "4.3.0";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // Generated by scripts/generate-package-versions.ts. Do not edit.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.version = void 0;
5
+ /** Installed @morpho-org/morpho-test package version. */
6
+ exports.version = "4.3.0";
@@ -1,9 +1,10 @@
1
1
  import { strictEqual } from "node:assert";
2
2
  import { Market, MarketParams, midnightAbi, OfferUtils, PriceRatifierV1, RateRatifierV1, SetterRatifier, SetterRatifierUtils, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
3
3
  import { getChainAddress } from "@morpho-org/morpho-ts";
4
- import { erc20Abi, maxUint256, parseEther, zeroAddress, } from "viem";
5
- import { getE2eAsset } from "./asset.js";
4
+ import { erc20Abi, isAddressEqual, maxUint256, parseEther, zeroAddress, } from "viem";
5
+ import { E2E_ASSET_BYTECODE, getE2eAsset } from "./asset.js";
6
6
  import { installE2eAsset, installE2eOracle, wrapE2eNative } from "./setup.js";
7
+ const collateralToken = "0xE2e0000000000000000000000000000000000004";
7
8
  /** Fork addresses of the named E2E wallets. */
8
9
  export const E2E_MIDNIGHT_WALLETS = {
9
10
  A: "0x00000000000000000000000000000000e2E0000A",
@@ -24,7 +25,6 @@ export const createE2eMidnightMarket = async (client, chainId, options = {}) =>
24
25
  const midnight = getChainAddress(chainId, "midnight");
25
26
  const loanAsset = getE2eAsset(chainId);
26
27
  const loanToken = loanAsset.address.toLowerCase();
27
- const collateralToken = "0xE2e0000000000000000000000000000000000004";
28
28
  if (loanAsset.requiresInstall)
29
29
  await installE2eAsset(client, loanToken);
30
30
  await installE2eAsset(client, collateralToken);
@@ -109,6 +109,12 @@ export const fundE2eMidnightWallets = async (client, params) => {
109
109
  account,
110
110
  amount: balanceBefore + amount,
111
111
  });
112
+ if (isAddressEqual(token, collateralToken) &&
113
+ (await client.getCode({ address: token })) === E2E_ASSET_BYTECODE)
114
+ await client.setBalance({
115
+ address: token,
116
+ value: (await client.getBalance({ address: token })) + amount,
117
+ });
112
118
  }
113
119
  strictEqual(await client.readContract({
114
120
  address: token,
@@ -1,5 +1,5 @@
1
1
  import { ORACLE_PRICE_SCALE } from "@morpho-org/blue-sdk";
2
- import { numberToHex, parseEther } from "viem";
2
+ import { isAddressEqual, numberToHex, parseEther, } from "viem";
3
3
  import { E2E_ASSET_BYTECODE, E2E_ASSET_STORAGE, getE2eAsset } from "./asset.js";
4
4
  /** Address of the fixed-price oracle installed on every fork. */
5
5
  const E2E_ORACLE = "0xE2E0000000000000000000000000000000000001";
@@ -62,6 +62,13 @@ export const wrapE2eNative = async (client, params) => {
62
62
  amount: (await client.balanceOf({ erc20: params.wNative, owner: account })) +
63
63
  params.amount,
64
64
  });
65
+ if (isAddressEqual(params.wNative, getE2eAsset(client.chain.id).address) &&
66
+ (await client.getCode({ address: params.wNative })) === E2E_ASSET_BYTECODE)
67
+ await client.setBalance({
68
+ address: params.wNative,
69
+ value: (await client.getBalance({ address: params.wNative })) +
70
+ params.amount,
71
+ });
65
72
  return;
66
73
  }
67
74
  if (params.account == null) {
@@ -5,7 +5,6 @@ export const withSimplePermit = {
5
5
  addressesRegistry[ChainId.EthMainnet].sDai,
6
6
  addressesRegistry[ChainId.EthMainnet].osEth,
7
7
  addressesRegistry[ChainId.EthMainnet].usdc,
8
- addressesRegistry[ChainId.EthMainnet].dai,
9
8
  ]),
10
9
  [ChainId.BaseMainnet]: new Set([
11
10
  addressesRegistry[ChainId.BaseMainnet].usdc,
@@ -29,7 +29,7 @@ export const vaults = {
29
29
  decimalsOffset: 12n,
30
30
  symbol: "bbUSDC",
31
31
  name: "BlockAnalytica USDC",
32
- asset: wNative,
32
+ asset: usdc,
33
33
  }),
34
34
  bbEth: new VaultConfig({
35
35
  address: "0x38989BBA00BDF8181F4082995b3DEAe96163aC5D",
@@ -1,2 +1,3 @@
1
1
  export * from "./e2e/index.js";
2
2
  export * from "./fixtures/index.js";
3
+ export { version } from "./version.js";
package/lib/esm/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./e2e/index.js";
2
2
  export * from "./fixtures/index.js";
3
+ export { version } from "./version.js";
@@ -0,0 +1,2 @@
1
+ /** Installed @morpho-org/morpho-test package version. */
2
+ export declare const version = "4.3.0";
@@ -0,0 +1,3 @@
1
+ // Generated by scripts/generate-package-versions.ts. Do not edit.
2
+ /** Installed @morpho-org/morpho-test package version. */
3
+ export const version = "4.3.0";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morpho-org/morpho-test",
3
3
  "description": "Framework-agnostic extension of `@morpho-org/blue-sdk` that exports test fixtures and registry-driven E2E chain selection for tests on forks.",
4
- "version": "4.2.0",
4
+ "version": "4.3.0",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -46,12 +46,12 @@
46
46
  "@morpho-org/midnight-sdk": "^2.2.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@morpho-org/blue-sdk": "^8.1.0",
50
- "@morpho-org/morpho-ts": "^4.1.0",
51
- "@morpho-org/test": "^2.12.0",
49
+ "@morpho-org/blue-sdk": "^8.3.0",
50
+ "@morpho-org/morpho-ts": "^4.4.0",
51
+ "@morpho-org/test": "^2.13.0",
52
52
  "typescript": "7.0.2",
53
53
  "viem": "^2.55.10",
54
- "@morpho-org/midnight-sdk": "^2.3.0"
54
+ "@morpho-org/midnight-sdk": "^2.6.0"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "@morpho-org/midnight-sdk": {