Skip to content

Commit

Permalink
chore: add _2 of aave and spark sl
Browse files Browse the repository at this point in the history
  • Loading branch information
halaprix committed Jan 26, 2024
1 parent 871a5da commit 9ecd955
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/automation/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
45 changes: 40 additions & 5 deletions packages/automation/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const commandTypeJsonMapping: Record<CommandContractType, string[]> = {
'maxCoverage',
'debtToken',
'collateralToken',
'opHash',
'opName',
'execLtv',
'targetLtv',
'minSellPrice',
Expand All @@ -117,13 +117,31 @@ export const commandTypeJsonMapping: Record<CommandContractType, string[]> = {
'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<
Expand Down Expand Up @@ -205,7 +223,6 @@ export const commandAddressMapping: Record<
},
},
[EthereumNetwork.BASE]: {

'0xb7CB13e4cD2D64e739b5746563978Ab7ee36B064': {
type: CommandContractType.AaveBasicBuyCommandV2,
},
Expand Down Expand Up @@ -296,7 +313,7 @@ export const defaultCommandTypeMapping = {
'uint256', // maxCoverage
'address', // debtToken
'address', // collateralToken
'bytes32', // opHash
'bytes32', // opName
'uint256', // execCollRatio
'uint256', // targetCollRatio
'uint256', // maxBuyPrice
Expand All @@ -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<CommandContractType, string[]> {
Expand Down
10 changes: 10 additions & 0 deletions packages/automation/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export enum CommandContractType {
SparkStopLossCommandV2 = 'SparkStopLossCommandV2',
AaveBasicBuyCommandV2 = 'AaveBasicBuyCommandV2',
AaveBasicSellCommandV2 = 'AaveBasicSellCommandV2',
SparkStopLossCommandV2_2 = 'SparkStopLossCommandV2_2',
AaveStopLossCommandV2_2 = 'AaveStopLossCommandV2_2',
}

export enum TriggerType {
Expand All @@ -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<TriggerType, CommandContractType> = {
Expand All @@ -71,6 +77,10 @@ export const triggerTypeToCommandContractTypeMap: Record<TriggerType, CommandCon
[TriggerType.SparkStopLossToDebtV2]: CommandContractType.SparkStopLossCommandV2,
[TriggerType.AaveBasicBuyV2]: CommandContractType.AaveBasicBuyCommandV2,
[TriggerType.AaveBasicSellV2]: CommandContractType.AaveBasicSellCommandV2,
[TriggerType.AaveStopLossToCollateralV2_2]: CommandContractType.AaveStopLossCommandV2_2,
[TriggerType.AaveStopLossToDebtV2_2]: CommandContractType.AaveStopLossCommandV2_2,
[TriggerType.SparkStopLossToCollateralV2_2]: CommandContractType.SparkStopLossCommandV2_2,
[TriggerType.SparkStopLossToDebtV2_2]: CommandContractType.SparkStopLossCommandV2_2,
};

export enum TriggerGroupType {
Expand Down

0 comments on commit 9ecd955

Please sign in to comment.