From 7a77408a7555ddfcacad486706e6a6f353aeafa0 Mon Sep 17 00:00:00 2001 From: Halaprix Date: Mon, 26 Feb 2024 15:25:22 +0100 Subject: [PATCH] feat: add spark triggers (#113) * feat: add spark triggers * chore: add spark command addresses * chore: add missing aave sl * chore: add spark bb bs addresses * chore: format --- packages/automation/package.json | 2 +- packages/automation/src/mapping.ts | 108 +++++++++++++++++++++++++++++ packages/automation/src/types.ts | 9 +++ 3 files changed, 118 insertions(+), 1 deletion(-) diff --git a/packages/automation/package.json b/packages/automation/package.json index 2f17d63..8195247 100644 --- a/packages/automation/package.json +++ b/packages/automation/package.json @@ -1,7 +1,7 @@ { "name": "@oasisdex/automation", "packageManager": "yarn@1.22.21", - "version": "1.6.0-alpha.16", + "version": "1.6.3", "description": "The set of utilities for Oasis automation", "homepage": "https://github.com/OasisDEX/common#readme", "main": "lib/src/index.js", diff --git a/packages/automation/src/mapping.ts b/packages/automation/src/mapping.ts index 2e8d910..886b22a 100644 --- a/packages/automation/src/mapping.ts +++ b/packages/automation/src/mapping.ts @@ -156,6 +156,46 @@ export const commandTypeJsonMapping: Record = { 'trailingDistance', 'closeToCollateral', ], + [CommandContractType.DmaSparkTrailingStopLossCommandV2]: [ + 'positionAddress', + 'triggerType', + 'maxCoverage', + 'debtToken', + 'collateralToken', + 'operationName', + 'collateralOracle', + 'collateralAddedRoundId', + 'debtOracle', + 'debtAddedRoundId', + 'trailingDistance', + 'closeToCollateral', + ], + [CommandContractType.DmaSparkBasicSellCommandV2]: [ + 'positionAddress', + 'triggerType', + 'maxCoverage', + 'debtToken', + 'collateralToken', + 'operationName', + 'executionLtv', + 'targetLtv', + 'minSellPrice', + 'deviation', + 'maxBaseFeeInGwei', + ], + [CommandContractType.DmaSparkBasicBuyCommandV2]: [ + 'positionAddress', + 'triggerType', + 'maxCoverage', + 'debtToken', + 'collateralToken', + 'operationName', + 'executionLtv', + 'targetLtv', + 'maxBuyPrice', + 'deviation', + 'maxBaseFeeInGwei', + ], }; export const commandOffchainDataTypeJsonMapping: Partial> = { [CommandContractType.DmaAaveTrailingStopLossCommandV2]: [ @@ -163,6 +203,11 @@ export const commandOffchainDataTypeJsonMapping: Partial { diff --git a/packages/automation/src/types.ts b/packages/automation/src/types.ts index 5233d5a..c2da8bf 100644 --- a/packages/automation/src/types.ts +++ b/packages/automation/src/types.ts @@ -26,6 +26,9 @@ export enum CommandContractType { DmaSparkStopLossCommandV2 = 'DmaSparkStopLossCommandV2', DmaAaveStopLossCommandV2 = 'DmaAaveV3StopLossCommandV2', DmaAaveTrailingStopLossCommandV2 = 'DmaAaveV3TrailingStopLossCommandV2', + DmaSparkTrailingStopLossCommandV2 = 'DmaSparkTrailingStopLossCommandV2', + DmaSparkBasicBuyCommandV2 = 'DmaSparkBasicBuyCommandV2', + DmaSparkBasicSellCommandV2 = 'DmaSparkBasicSellCommandV2', } export enum TriggerType { @@ -54,7 +57,10 @@ export enum TriggerType { DmaAaveStopLossToDebtV2 = 128, DmaSparkStopLossToCollateralV2 = 129, DmaSparkStopLossToDebtV2 = 130, + DmaSparkBasicBuyV2 = 131, + DmaSparkBasicSellV2 = 132, DmaAaveTrailingStopLossV2 = 10006, + DmaSparkTrailingStopLossV2 = 10007, } export const triggerTypeToCommandContractTypeMap: Record = { @@ -84,6 +90,9 @@ export const triggerTypeToCommandContractTypeMap: Record