@defisaver/automation-sdk 3.3.7-dev.0 → 3.3.7-morpho-dev-1
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.
- package/cjs/automation/private/StrategiesAutomation.js +2 -0
- package/cjs/constants/index.js +15 -0
- package/cjs/services/strategiesService.js +30 -0
- package/cjs/services/strategySubService.d.ts +1 -0
- package/cjs/services/strategySubService.js +7 -0
- package/cjs/services/strategySubService.test.js +38 -0
- package/cjs/services/subDataService.d.ts +12 -0
- package/cjs/services/subDataService.js +31 -1
- package/cjs/services/subDataService.test.js +52 -0
- package/cjs/services/triggerService.d.ts +10 -0
- package/cjs/services/triggerService.js +21 -1
- package/cjs/services/triggerService.test.js +48 -0
- package/cjs/types/enums.d.ts +6 -3
- package/cjs/types/enums.js +3 -0
- package/esm/automation/private/StrategiesAutomation.js +2 -0
- package/esm/constants/index.js +15 -0
- package/esm/services/strategiesService.js +30 -0
- package/esm/services/strategySubService.d.ts +1 -0
- package/esm/services/strategySubService.js +7 -0
- package/esm/services/strategySubService.test.js +38 -0
- package/esm/services/subDataService.d.ts +12 -0
- package/esm/services/subDataService.js +30 -0
- package/esm/services/subDataService.test.js +52 -0
- package/esm/services/triggerService.d.ts +10 -0
- package/esm/services/triggerService.js +20 -0
- package/esm/services/triggerService.test.js +49 -1
- package/esm/types/enums.d.ts +6 -3
- package/esm/types/enums.js +3 -0
- package/package.json +2 -2
- package/src/constants/index.ts +15 -0
- package/src/services/strategiesService.ts +43 -0
- package/src/services/strategySubService.test.ts +55 -0
- package/src/services/strategySubService.ts +21 -0
- package/src/services/subDataService.test.ts +59 -0
- package/src/services/subDataService.ts +40 -0
- package/src/services/triggerService.test.ts +53 -0
- package/src/services/triggerService.ts +32 -0
- package/src/types/enums.ts +3 -0
|
@@ -688,4 +688,36 @@ export const sparkQuotePriceRangeTrigger = {
|
|
|
688
688
|
upperPrice: new Dec(decodedData[3] as string).div(1e8).toString(),
|
|
689
689
|
};
|
|
690
690
|
},
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
export const morphoBluePriceRangeTrigger = {
|
|
694
|
+
encode(
|
|
695
|
+
oracle: EthereumAddress,
|
|
696
|
+
collateralToken: EthereumAddress,
|
|
697
|
+
loanToken: EthereumAddress,
|
|
698
|
+
lowerPrice: number,
|
|
699
|
+
upperPrice: number,
|
|
700
|
+
) {
|
|
701
|
+
// Price is scaled to 1e8
|
|
702
|
+
const lowerPriceFormatted = new Dec(lowerPrice).mul(1e8).floor().toString();
|
|
703
|
+
const upperPriceFormatted = new Dec(upperPrice).mul(1e8).floor().toString();
|
|
704
|
+
return [
|
|
705
|
+
AbiCoder.encodeParameters(
|
|
706
|
+
['address', 'address', 'address', 'uint256', 'uint256'],
|
|
707
|
+
[oracle, collateralToken, loanToken, lowerPriceFormatted, upperPriceFormatted],
|
|
708
|
+
),
|
|
709
|
+
];
|
|
710
|
+
},
|
|
711
|
+
decode(
|
|
712
|
+
triggerData: TriggerData,
|
|
713
|
+
) {
|
|
714
|
+
const decodedData = AbiCoder.decodeParameters(['address', 'address', 'address', 'uint256', 'uint256'], triggerData[0]);
|
|
715
|
+
return {
|
|
716
|
+
oracle: decodedData[0] as EthereumAddress,
|
|
717
|
+
collateralToken: decodedData[1] as EthereumAddress,
|
|
718
|
+
loanToken: decodedData[2] as EthereumAddress,
|
|
719
|
+
lowerPrice: new Dec(decodedData[3] as string).div(1e8).toString(),
|
|
720
|
+
upperPrice: new Dec(decodedData[4] as string).div(1e8).toString(),
|
|
721
|
+
};
|
|
722
|
+
},
|
|
691
723
|
};
|
package/src/types/enums.ts
CHANGED
|
@@ -222,6 +222,7 @@ export namespace Bundles {
|
|
|
222
222
|
AAVE_V3_EOA_BOOST_ON_PRICE = 55,
|
|
223
223
|
AAVE_V3_EOA_CLOSE = 56,
|
|
224
224
|
SPARK_CLOSE = 57,
|
|
225
|
+
MORPHO_BLUE_CLOSE = 58,
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
export enum OptimismIds {
|
|
@@ -265,6 +266,7 @@ export namespace Bundles {
|
|
|
265
266
|
AAVE_V3_EOA_REPAY_ON_PRICE = 25,
|
|
266
267
|
AAVE_V3_EOA_BOOST_ON_PRICE = 26,
|
|
267
268
|
AAVE_V3_EOA_CLOSE = 27,
|
|
269
|
+
MORPHO_BLUE_CLOSE = 28,
|
|
268
270
|
}
|
|
269
271
|
|
|
270
272
|
export enum ArbitrumIds {
|
|
@@ -296,6 +298,7 @@ export namespace Bundles {
|
|
|
296
298
|
MORPHO_BLUE_BOOST_ON_PRICE = 25,
|
|
297
299
|
MORPHO_BLUE_EOA_REPAY = 26,
|
|
298
300
|
MORPHO_BLUE_EOA_BOOST = 27,
|
|
301
|
+
MORPHO_BLUE_CLOSE = 28,
|
|
299
302
|
}
|
|
300
303
|
}
|
|
301
304
|
|