@morpho-org/blue-sdk 1.5.5 → 1.5.7

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.
@@ -24,6 +24,7 @@ export declare const addresses: {
24
24
  aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76";
25
25
  aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC";
26
26
  compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558";
27
+ compoundV2Bundler: "0x26bf52a84360ad3d01d7cdc28fc2ddc04d8c8647";
27
28
  adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
28
29
  publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
29
30
  wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
@@ -57,6 +58,7 @@ export declare const addresses: {
57
58
  morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
58
59
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
59
60
  bundler: "0x23055618898e202386e6c13955a58D3C68200BFB";
61
+ compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223";
60
62
  aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108";
61
63
  compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA";
62
64
  adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
@@ -75,6 +77,7 @@ export interface ChainAddresses {
75
77
  aaveV2Bundler?: Address;
76
78
  aaveV3Bundler?: Address;
77
79
  compoundV3Bundler?: Address;
80
+ compoundV2Bundler?: Address;
78
81
  adaptiveCurveIrm?: Address;
79
82
  publicAllocator?: Address;
80
83
  wNative: Address;
package/lib/addresses.js CHANGED
@@ -29,6 +29,7 @@ exports.addresses = {
29
29
  aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76",
30
30
  aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC",
31
31
  compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558",
32
+ compoundV2Bundler: "0x26bf52a84360ad3d01d7cdc28fc2ddc04d8c8647",
32
33
  adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
33
34
  publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
34
35
  wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
@@ -66,6 +67,7 @@ exports.addresses = {
66
67
  morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
67
68
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
68
69
  bundler: "0x23055618898e202386e6c13955a58D3C68200BFB",
70
+ compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223",
69
71
  aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108",
70
72
  compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA",
71
73
  adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
@@ -98,17 +98,17 @@ export declare class MathLib {
98
98
  */
99
99
  static wTaylorCompounded(x: BigIntish, n: BigIntish): bigint;
100
100
  /**
101
- * Converts an apr to compounded apy
101
+ * Converts an rate to compounded apy
102
102
  *
103
- * @param apr The rate to convert (in WAD)
104
- * @param compounding The compounding basis
103
+ * @param rate The rate to convert (in WAD)
104
+ * @param period The compounding basis
105
105
  */
106
- static rateToApy(rate: BigIntish, unit: Time.Unit): number;
106
+ static rateToApy(rate: BigIntish, period: Time.PeriodLike): number;
107
107
  /**
108
108
  * Converts an apr to compounded apy
109
109
  *
110
- * @param apr The yearly apr to convert (in WAD)
110
+ * @param apr The apr to convert (in WAD)
111
111
  * @param compounding The compounding basis
112
112
  */
113
- static aprToApy(apr: BigIntish, compounding: Time.Unit): number;
113
+ static aprToApy(apr: BigIntish, compounding: Time.PeriodLike): number;
114
114
  }
@@ -149,24 +149,25 @@ class MathLib {
149
149
  return firstTerm + secondTerm + thirdTerm;
150
150
  }
151
151
  /**
152
- * Converts an apr to compounded apy
152
+ * Converts an rate to compounded apy
153
153
  *
154
- * @param apr The rate to convert (in WAD)
155
- * @param compounding The compounding basis
154
+ * @param rate The rate to convert (in WAD)
155
+ * @param period The compounding basis
156
156
  */
157
- static rateToApy(rate, unit) {
158
- const factor = morpho_ts_1.Time[unit].from.y(1n);
159
- return ((1 + Number(helpers_1.format.number.of(BigInt(rate), 18))) ** Number(factor) - 1);
157
+ static rateToApy(rate, period) {
158
+ const { unit, duration } = morpho_ts_1.Time.toPeriod(period);
159
+ const factor = morpho_ts_1.Time[unit].from.y(1) / duration;
160
+ return (1 + Number(helpers_1.format.number.of(BigInt(rate), 18))) ** factor - 1;
160
161
  }
161
162
  /**
162
163
  * Converts an apr to compounded apy
163
164
  *
164
- * @param apr The yearly apr to convert (in WAD)
165
+ * @param apr The apr to convert (in WAD)
165
166
  * @param compounding The compounding basis
166
167
  */
167
168
  static aprToApy(apr, compounding) {
168
- const factor = morpho_ts_1.Time[compounding].from.y(1n);
169
- const rate = BigInt(apr) / factor;
169
+ const { unit, duration } = morpho_ts_1.Time.toPeriod(compounding);
170
+ const rate = (BigInt(apr) * BigInt(duration)) / morpho_ts_1.Time[unit].from.y(1n);
170
171
  return this.rateToApy(rate, compounding);
171
172
  }
172
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morpho-org/blue-sdk",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "author": "Morpho Association <contact@morpho.org>",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -16,8 +16,8 @@
16
16
  "keccak256": "^1.0.6"
17
17
  },
18
18
  "devDependencies": {
19
- "@morpho-org/morpho-test": "^1.5.5",
20
- "@morpho-org/morpho-ts": "^1.5.5",
19
+ "@morpho-org/morpho-test": "^1.5.7",
20
+ "@morpho-org/morpho-ts": "^1.5.7",
21
21
  "@types/jest": "^29.5.12",
22
22
  "@types/node": "^22.1.0",
23
23
  "jest": "^29.7.0",
@@ -25,7 +25,7 @@
25
25
  "typescript": "^5.4.5"
26
26
  },
27
27
  "peerDependencies": {
28
- "@morpho-org/morpho-ts": "^1.5.5"
28
+ "@morpho-org/morpho-ts": "^1.5.7"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
@@ -49,5 +49,5 @@
49
49
  ],
50
50
  "preset": "ts-jest"
51
51
  },
52
- "gitHead": "81bdd19a15cf63595baf5d6c13ba7dcbadec8300"
52
+ "gitHead": "5b9230f0f757e778701baa6d3203cdccbdb715c4"
53
53
  }