@defisaver/automation-sdk 1.2.9 → 1.2.11
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.
|
@@ -136,15 +136,17 @@ export const compoundV3LeverageManagementSubData = {
|
|
|
136
136
|
};
|
|
137
137
|
export const morphoAaveV2LeverageManagementSubData = {
|
|
138
138
|
encode(minRatio, maxRatio, maxOptimalRatio, minOptimalRatio, boostEnabled) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
return [
|
|
140
|
+
ratioPercentageToWei(minRatio),
|
|
141
|
+
ratioPercentageToWei(maxRatio),
|
|
142
|
+
ratioPercentageToWei(maxOptimalRatio),
|
|
143
|
+
ratioPercentageToWei(minOptimalRatio),
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
boostEnabled,
|
|
146
|
+
];
|
|
145
147
|
},
|
|
146
148
|
decode(subData) {
|
|
147
|
-
const ratioWei = mockedWeb3.eth.abi.decodeParameter('uint128', subData[
|
|
149
|
+
const ratioWei = mockedWeb3.eth.abi.decodeParameter('uint128', subData[1]);
|
|
148
150
|
const targetRatio = weiToRatioPercentage(ratioWei);
|
|
149
151
|
return { targetRatio };
|
|
150
152
|
},
|
|
@@ -49,15 +49,15 @@ export const aaveV3RatioTrigger = {
|
|
|
49
49
|
};
|
|
50
50
|
export const morphoAaveV2RatioTrigger = {
|
|
51
51
|
encode(owner, ratioPercentage, ratioState) {
|
|
52
|
-
const ratioWei =
|
|
53
|
-
return [mockedWeb3.eth.abi.encodeParameters(['address', '
|
|
52
|
+
const ratioWei = new Dec(ratioPercentage).mul(1e16).toString();
|
|
53
|
+
return [mockedWeb3.eth.abi.encodeParameters(['address', 'uint128', 'uint8'], [owner, ratioWei, ratioState])];
|
|
54
54
|
},
|
|
55
55
|
decode(triggerData) {
|
|
56
|
-
const decodedData = mockedWeb3.eth.abi.decodeParameters(['address', '
|
|
56
|
+
const decodedData = mockedWeb3.eth.abi.decodeParameters(['address', 'uint128', 'uint8'], triggerData[0]);
|
|
57
57
|
return {
|
|
58
58
|
owner: decodedData[0],
|
|
59
|
-
ratio: new Dec(
|
|
60
|
-
ratioState: Number(decodedData[
|
|
59
|
+
ratio: new Dec(decodedData[1]).div(1e16).toNumber(),
|
|
60
|
+
ratioState: Number(decodedData[2]),
|
|
61
61
|
};
|
|
62
62
|
},
|
|
63
63
|
};
|
package/package.json
CHANGED
|
@@ -203,16 +203,17 @@ export const morphoAaveV2LeverageManagementSubData = {
|
|
|
203
203
|
minOptimalRatio: number,
|
|
204
204
|
boostEnabled: boolean,
|
|
205
205
|
): SubData {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
206
|
+
return [
|
|
207
|
+
ratioPercentageToWei(minRatio),
|
|
208
|
+
ratioPercentageToWei(maxRatio),
|
|
209
|
+
ratioPercentageToWei(maxOptimalRatio),
|
|
210
|
+
ratioPercentageToWei(minOptimalRatio),
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
boostEnabled,
|
|
213
|
+
];
|
|
213
214
|
},
|
|
214
215
|
decode(subData: SubData): { targetRatio: number } {
|
|
215
|
-
const ratioWei = mockedWeb3.eth.abi.decodeParameter('uint128', subData[
|
|
216
|
+
const ratioWei = mockedWeb3.eth.abi.decodeParameter('uint128', subData[1]) as any as string;
|
|
216
217
|
const targetRatio = weiToRatioPercentage(ratioWei);
|
|
217
218
|
|
|
218
219
|
return { targetRatio };
|
|
@@ -61,15 +61,15 @@ export const aaveV3RatioTrigger = {
|
|
|
61
61
|
|
|
62
62
|
export const morphoAaveV2RatioTrigger = {
|
|
63
63
|
encode(owner: EthereumAddress, ratioPercentage: number, ratioState: RatioState) {
|
|
64
|
-
const ratioWei =
|
|
65
|
-
return [mockedWeb3.eth.abi.encodeParameters(['address', '
|
|
64
|
+
const ratioWei = new Dec(ratioPercentage).mul(1e16).toString();
|
|
65
|
+
return [mockedWeb3.eth.abi.encodeParameters(['address', 'uint128', 'uint8'], [owner, ratioWei, ratioState])];
|
|
66
66
|
},
|
|
67
67
|
decode(triggerData: TriggerData) {
|
|
68
|
-
const decodedData = mockedWeb3.eth.abi.decodeParameters(['address', '
|
|
68
|
+
const decodedData = mockedWeb3.eth.abi.decodeParameters(['address', 'uint128', 'uint8'], triggerData[0]) as string[];
|
|
69
69
|
return {
|
|
70
70
|
owner: decodedData[0],
|
|
71
|
-
ratio: new Dec(
|
|
72
|
-
ratioState: Number(decodedData[
|
|
71
|
+
ratio: new Dec(decodedData[1]).div(1e16).toNumber(),
|
|
72
|
+
ratioState: Number(decodedData[2]),
|
|
73
73
|
};
|
|
74
74
|
},
|
|
75
75
|
};
|
package/umd/index.js
CHANGED
|
@@ -19141,15 +19141,12 @@ var compoundV3LeverageManagementSubData = {
|
|
|
19141
19141
|
};
|
|
19142
19142
|
var morphoAaveV2LeverageManagementSubData = {
|
|
19143
19143
|
encode(minRatio, maxRatio, maxOptimalRatio, minOptimalRatio, boostEnabled) {
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
var encodedMinOptimalRatio = mockedWeb3.eth.abi.encodeParameter('uint128', (0,_utils__WEBPACK_IMPORTED_MODULE_5__.ratioPercentageToWei)(minOptimalRatio));
|
|
19148
|
-
var encodedBoostEnabled = mockedWeb3.eth.abi.encodeParameter('bool', boostEnabled);
|
|
19149
|
-
return [encodedMinRatio, encodedMaxRatio, encodedMaxOptimalRatio, encodedMinOptimalRatio, encodedBoostEnabled];
|
|
19144
|
+
return [(0,_utils__WEBPACK_IMPORTED_MODULE_5__.ratioPercentageToWei)(minRatio), (0,_utils__WEBPACK_IMPORTED_MODULE_5__.ratioPercentageToWei)(maxRatio), (0,_utils__WEBPACK_IMPORTED_MODULE_5__.ratioPercentageToWei)(maxOptimalRatio), (0,_utils__WEBPACK_IMPORTED_MODULE_5__.ratioPercentageToWei)(minOptimalRatio),
|
|
19145
|
+
// @ts-ignore
|
|
19146
|
+
boostEnabled];
|
|
19150
19147
|
},
|
|
19151
19148
|
decode(subData) {
|
|
19152
|
-
var ratioWei = mockedWeb3.eth.abi.decodeParameter('uint128', subData[
|
|
19149
|
+
var ratioWei = mockedWeb3.eth.abi.decodeParameter('uint128', subData[1]);
|
|
19153
19150
|
var targetRatio = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.weiToRatioPercentage)(ratioWei);
|
|
19154
19151
|
return {
|
|
19155
19152
|
targetRatio
|
|
@@ -28776,15 +28773,15 @@ var aaveV3RatioTrigger = {
|
|
|
28776
28773
|
};
|
|
28777
28774
|
var morphoAaveV2RatioTrigger = {
|
|
28778
28775
|
encode(owner, ratioPercentage, ratioState) {
|
|
28779
|
-
var ratioWei = (
|
|
28780
|
-
return [mockedWeb3.eth.abi.encodeParameters(['address', '
|
|
28776
|
+
var ratioWei = new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(ratioPercentage).mul(1e16).toString();
|
|
28777
|
+
return [mockedWeb3.eth.abi.encodeParameters(['address', 'uint128', 'uint8'], [owner, ratioWei, ratioState])];
|
|
28781
28778
|
},
|
|
28782
28779
|
decode(triggerData) {
|
|
28783
|
-
var decodedData = mockedWeb3.eth.abi.decodeParameters(['address', '
|
|
28780
|
+
var decodedData = mockedWeb3.eth.abi.decodeParameters(['address', 'uint128', 'uint8'], triggerData[0]);
|
|
28784
28781
|
return {
|
|
28785
28782
|
owner: decodedData[0],
|
|
28786
|
-
ratio: new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(
|
|
28787
|
-
ratioState: Number(decodedData[
|
|
28783
|
+
ratio: new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(decodedData[1]).div(1e16).toNumber(),
|
|
28784
|
+
ratioState: Number(decodedData[2])
|
|
28788
28785
|
};
|
|
28789
28786
|
}
|
|
28790
28787
|
};
|