From 9ecd955b32836193d7a9021743a7b9d59897d3ae Mon Sep 17 00:00:00 2001 From: halaprix Date: Fri, 26 Jan 2024 11:46:37 +0100 Subject: [PATCH] chore: add `_2` of aave and spark sl --- packages/automation/package.json | 2 +- packages/automation/src/mapping.ts | 45 ++++++++++++++++++++++++++---- packages/automation/src/types.ts | 10 +++++++ 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/packages/automation/package.json b/packages/automation/package.json index 3c6373d..52d0d51 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", + "version": "1.6.0-alpha.1", "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 d188a3a..5ba54a6 100644 --- a/packages/automation/src/mapping.ts +++ b/packages/automation/src/mapping.ts @@ -104,7 +104,7 @@ export const commandTypeJsonMapping: Record = { 'maxCoverage', 'debtToken', 'collateralToken', - 'opHash', + 'opName', 'execLtv', 'targetLtv', 'minSellPrice', @@ -117,13 +117,31 @@ export const commandTypeJsonMapping: Record = { 'maxCoverage', 'debtToken', 'collateralToken', - 'opHash', + 'opName', 'execLtv', 'targetLtv', 'maxBuyPrice', 'deviation', 'maxBaseFeeInGwei', ], + [CommandContractType.AaveStopLossCommandV2_2]: [ + 'positionAddress', + 'triggerType', + 'maxCoverage', + 'debtToken', + 'collateralToken', + 'opName', + 'ltv', + ], + [CommandContractType.SparkStopLossCommandV2_2]: [ + 'positionAddress', + 'triggerType', + 'maxCoverage', + 'debtToken', + 'collateralToken', + 'opName', + 'ltv', + ], }; export const commandAddressMapping: Record< @@ -205,7 +223,6 @@ export const commandAddressMapping: Record< }, }, [EthereumNetwork.BASE]: { - '0xb7CB13e4cD2D64e739b5746563978Ab7ee36B064': { type: CommandContractType.AaveBasicBuyCommandV2, }, @@ -296,7 +313,7 @@ export const defaultCommandTypeMapping = { 'uint256', // maxCoverage 'address', // debtToken 'address', // collateralToken - 'bytes32', // opHash + 'bytes32', // opName 'uint256', // execCollRatio 'uint256', // targetCollRatio 'uint256', // maxBuyPrice @@ -309,13 +326,31 @@ export const defaultCommandTypeMapping = { 'uint256', // maxCoverage 'address', // debtToken 'address', // collateralToken - 'bytes32', // opHash + 'bytes32', // opName 'uint256', // execCollRatio 'uint256', // targetCollRatio 'uint256', // minSellPrice 'uint64', // deviation 'uint32', // maxBaseFeeInGwei ], + [CommandContractType.AaveStopLossCommandV2_2]: [ + 'address', //positionAddress + 'uint16', // triggerType + 'uint256', // maxCoverage + 'address', // debtToken + 'address', // collateralToken + 'bytes32', // opName + 'uint256', // executionLTV + ], + [CommandContractType.SparkStopLossCommandV2_2]: [ + 'address', //positionAddress + 'uint16', // triggerType + 'uint256', // maxCoverage + 'address', // debtToken + 'address', // collateralToken + 'bytes32', // opName + 'uint256', // executionLTV + ], } as const; export function getCommandAddresses(network: number): Record { diff --git a/packages/automation/src/types.ts b/packages/automation/src/types.ts index 68288b0..a82d69a 100644 --- a/packages/automation/src/types.ts +++ b/packages/automation/src/types.ts @@ -23,6 +23,8 @@ export enum CommandContractType { SparkStopLossCommandV2 = 'SparkStopLossCommandV2', AaveBasicBuyCommandV2 = 'AaveBasicBuyCommandV2', AaveBasicSellCommandV2 = 'AaveBasicSellCommandV2', + SparkStopLossCommandV2_2 = 'SparkStopLossCommandV2_2', + AaveStopLossCommandV2_2 = 'AaveStopLossCommandV2_2', } export enum TriggerType { @@ -47,6 +49,10 @@ export enum TriggerType { SparkStopLossToDebtV2 = 118, AaveBasicBuyV2 = 119, AaveBasicSellV2 = 120, + AaveStopLossToCollateralV2_2 = 121, + AaveStopLossToDebtV2_2 = 122, + SparkStopLossToCollateralV2_2 = 123, + SparkStopLossToDebtV2_2 = 124, } export const triggerTypeToCommandContractTypeMap: Record = { @@ -71,6 +77,10 @@ export const triggerTypeToCommandContractTypeMap: Record