@morpho-org/morpho-sdk 5.3.2 → 5.3.3
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.
|
@@ -45,8 +45,9 @@ export interface BlueActions {
|
|
|
45
45
|
/**
|
|
46
46
|
* Prepares a loan-asset supply transaction.
|
|
47
47
|
*
|
|
48
|
-
* Routed through bundler via GeneralAdapter1. Computes `maxSharePrice` from
|
|
49
|
-
*
|
|
48
|
+
* Routed through bundler via GeneralAdapter1. Computes `maxSharePrice` from the supply state of
|
|
49
|
+
* `marketData` forward-accrued to execution and `slippageTolerance` to protect against
|
|
50
|
+
* share-price inflation.
|
|
50
51
|
* `getRequirements` returns ERC20 approval or permit for `GeneralAdapter1` on the loan token.
|
|
51
52
|
* When `nativeAmount` is provided, native token is wrapped; the loan token must be wNative.
|
|
52
53
|
*
|
|
@@ -54,9 +54,12 @@ class MorphoBlue {
|
|
|
54
54
|
if (nativeAmount !== undefined && nativeAmount > 0n) {
|
|
55
55
|
(0, index_js_2.validateNativeAsset)(this.chainId, this.marketParams.loanToken);
|
|
56
56
|
}
|
|
57
|
+
// Forward-accrue (2h) before deriving `maxSharePrice`: on-chain `morphoSupply` accrues `lastUpdate → execution`, raising the supply share price, so an un-accrued bound reverts on quiet markets.
|
|
58
|
+
const accrualTimestamp = blue_sdk_1.MathLib.max(morpho_ts_1.Time.timestamp(), marketData.lastUpdate) + morpho_ts_1.Time.s.from.h(2n);
|
|
59
|
+
const marketForSupply = marketData.accrueInterest(accrualTimestamp);
|
|
57
60
|
const maxSharePrice = (0, index_js_2.computeMaxSupplySharePrice)({
|
|
58
61
|
supplyAssets: totalAssets,
|
|
59
|
-
market:
|
|
62
|
+
market: marketForSupply,
|
|
60
63
|
slippageTolerance,
|
|
61
64
|
});
|
|
62
65
|
return {
|
|
@@ -45,8 +45,9 @@ export interface BlueActions {
|
|
|
45
45
|
/**
|
|
46
46
|
* Prepares a loan-asset supply transaction.
|
|
47
47
|
*
|
|
48
|
-
* Routed through bundler via GeneralAdapter1. Computes `maxSharePrice` from
|
|
49
|
-
*
|
|
48
|
+
* Routed through bundler via GeneralAdapter1. Computes `maxSharePrice` from the supply state of
|
|
49
|
+
* `marketData` forward-accrued to execution and `slippageTolerance` to protect against
|
|
50
|
+
* share-price inflation.
|
|
50
51
|
* `getRequirements` returns ERC20 approval or permit for `GeneralAdapter1` on the loan token.
|
|
51
52
|
* When `nativeAmount` is provided, native token is wrapped; the loan token must be wNative.
|
|
52
53
|
*
|
|
@@ -51,9 +51,12 @@ export class MorphoBlue {
|
|
|
51
51
|
if (nativeAmount !== undefined && nativeAmount > 0n) {
|
|
52
52
|
validateNativeAsset(this.chainId, this.marketParams.loanToken);
|
|
53
53
|
}
|
|
54
|
+
// Forward-accrue (2h) before deriving `maxSharePrice`: on-chain `morphoSupply` accrues `lastUpdate → execution`, raising the supply share price, so an un-accrued bound reverts on quiet markets.
|
|
55
|
+
const accrualTimestamp = MathLib.max(Time.timestamp(), marketData.lastUpdate) + Time.s.from.h(2n);
|
|
56
|
+
const marketForSupply = marketData.accrueInterest(accrualTimestamp);
|
|
54
57
|
const maxSharePrice = computeMaxSupplySharePrice({
|
|
55
58
|
supplyAssets: totalAssets,
|
|
56
|
-
market:
|
|
59
|
+
market: marketForSupply,
|
|
57
60
|
slippageTolerance,
|
|
58
61
|
});
|
|
59
62
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/morpho-sdk",
|
|
3
3
|
"description": "Abstraction layer for Morpho's complexity.",
|
|
4
|
-
"version": "5.3.
|
|
4
|
+
"version": "5.3.3",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Foulks-Plb <https://x.com/FoulkPlb>"
|
|
@@ -160,8 +160,8 @@
|
|
|
160
160
|
"viem": "^2.54.2",
|
|
161
161
|
"vitest": "^4.1.9",
|
|
162
162
|
"@morpho-org/bundler-sdk-viem": "^5.0.3",
|
|
163
|
-
"@morpho-org/
|
|
164
|
-
"@morpho-org/
|
|
163
|
+
"@morpho-org/simulation-sdk": "^4.0.3",
|
|
164
|
+
"@morpho-org/test": "^2.8.3"
|
|
165
165
|
},
|
|
166
166
|
"scripts": {
|
|
167
167
|
"prepublish": "$npm_execpath build",
|