Skip to content

Commit

Permalink
chore: change trigger naming
Browse files Browse the repository at this point in the history
  • Loading branch information
halaprix committed Jan 30, 2024
1 parent a0fa350 commit b1826cd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 50 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": "[email protected]",
"version": "1.6.0-alpha.2",
"version": "1.6.0-alpha.3",
"description": "The set of utilities for Oasis automation",
"homepage": "https://github.com/OasisDEX/common#readme",
"main": "lib/src/index.js",
Expand Down
24 changes: 12 additions & 12 deletions packages/automation/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const commandTypeJsonMapping: Record<CommandContractType, string[]> = {
'executionPrice',
'maxBaseFeeInGwei',
],
[CommandContractType.AaveBasicSellCommandV2]: [
[CommandContractType.DmaAaveBasicSellCommandV2]: [
'positionAddress',
'triggerType',
'maxCoverage',
Expand All @@ -111,7 +111,7 @@ export const commandTypeJsonMapping: Record<CommandContractType, string[]> = {
'deviation',
'maxBaseFeeInGwei',
],
[CommandContractType.AaveBasicBuyCommandV2]: [
[CommandContractType.DmaAaveBasicBuyCommandV2]: [
'positionAddress',
'triggerType',
'maxCoverage',
Expand All @@ -124,7 +124,7 @@ export const commandTypeJsonMapping: Record<CommandContractType, string[]> = {
'deviation',
'maxBaseFeeInGwei',
],
[CommandContractType.AaveStopLossCommandV2_2]: [
[CommandContractType.DmaAaveStopLossCommandV2]: [
'positionAddress',
'triggerType',
'maxCoverage',
Expand All @@ -133,7 +133,7 @@ export const commandTypeJsonMapping: Record<CommandContractType, string[]> = {
'opName',
'ltv',
],
[CommandContractType.SparkStopLossCommandV2_2]: [
[CommandContractType.DmaSparkStopLossCommandV2]: [
'positionAddress',
'triggerType',
'maxCoverage',
Expand Down Expand Up @@ -216,18 +216,18 @@ export const commandAddressMapping: Record<
type: CommandContractType.SparkStopLossCommandV2,
},
'0x72241841022bc824B0b66e3D27D8937D36dA4FDF': {
type: CommandContractType.AaveBasicBuyCommandV2,
type: CommandContractType.DmaAaveBasicBuyCommandV2,
},
'0x31d767f6556CE3fC55d6245C9aEF3575aa64BABf': {
type: CommandContractType.AaveBasicSellCommandV2,
type: CommandContractType.DmaAaveBasicSellCommandV2,
},
},
[EthereumNetwork.BASE]: {
'0xb7CB13e4cD2D64e739b5746563978Ab7ee36B064': {
type: CommandContractType.AaveBasicBuyCommandV2,
type: CommandContractType.DmaAaveBasicBuyCommandV2,
},
'0xbf566C1b260F0464f75470C146288283f11219a9': {
type: CommandContractType.AaveBasicSellCommandV2,
type: CommandContractType.DmaAaveBasicSellCommandV2,
},
},
}).map(([network, mapping]) => [
Expand Down Expand Up @@ -307,7 +307,7 @@ export const defaultCommandTypeMapping = {
'uint64', // deviation
'uint32', // maxBaseFeeInGwei
],
[CommandContractType.AaveBasicBuyCommandV2]: [
[CommandContractType.DmaAaveBasicBuyCommandV2]: [
'address', //positionAddress
'uint16', // triggerType
'uint256', // maxCoverage
Expand All @@ -320,7 +320,7 @@ export const defaultCommandTypeMapping = {
'uint64', // deviation
'uint32', // maxBaseFeeInGwei
],
[CommandContractType.AaveBasicSellCommandV2]: [
[CommandContractType.DmaAaveBasicSellCommandV2]: [
'address', //positionAddress
'uint16', // triggerType
'uint256', // maxCoverage
Expand All @@ -333,7 +333,7 @@ export const defaultCommandTypeMapping = {
'uint64', // deviation
'uint32', // maxBaseFeeInGwei
],
[CommandContractType.AaveStopLossCommandV2_2]: [
[CommandContractType.DmaAaveStopLossCommandV2]: [
'address', //positionAddress
'uint16', // triggerType
'uint256', // maxCoverage
Expand All @@ -342,7 +342,7 @@ export const defaultCommandTypeMapping = {
'bytes32', // opName
'uint256', // executionLTV
],
[CommandContractType.SparkStopLossCommandV2_2]: [
[CommandContractType.DmaSparkStopLossCommandV2]: [
'address', //positionAddress
'uint16', // triggerType
'uint256', // maxCoverage
Expand Down
74 changes: 37 additions & 37 deletions packages/automation/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,39 @@ export enum CommandContractType {
MakerBasicBuyCommandV2 = 'MakerBasicBuyCommandV2',
MakerBasicSellCommandV2 = 'MakerBasicSellCommandV2',
SparkStopLossCommandV2 = 'SparkStopLossCommandV2',
AaveBasicBuyCommandV2 = 'AaveV3BasicBuyCommandV2',
AaveBasicSellCommandV2 = 'AaveV3BasicSellCommandV2',
SparkStopLossCommandV2_2 = 'DmaSparkStopLossCommandV2',
AaveStopLossCommandV2_2 = 'DmaAaveV3StopLossCommandV2',
DmaAaveBasicBuyCommandV2 = 'DmaAaveV3BasicBuyCommandV2',
DmaAaveBasicSellCommandV2 = 'DmaAaveV3BasicSellCommandV2',
DmaSparkStopLossCommandV2 = 'DmaSparkStopLossCommandV2',
DmaAaveStopLossCommandV2 = 'DmaAaveV3StopLossCommandV2',
}

export enum TriggerType {
StopLossToCollateral = 1,
StopLossToDai = 2,
BasicBuy = 3,
BasicSell = 4,
AutoTakeProfitToCollateral = 7,
AutoTakeProfitToDai = 8,
SimpleAAVESell = 9,
AaveStopLossToCollateral = 10,
AaveStopLossToDebt = 11,
MakerStopLossToCollateralV2 = 101,
MakerStopLossToDaiV2 = 102,
MakerBasicBuyV2 = 103,
MakerBasicSellV2 = 104,
MakerAutoTakeProfitToCollateralV2 = 105,
MakerAutoTakeProfitToDaiV2 = 106,
AaveStopLossToCollateralV2 = 111,
AaveStopLossToDebtV2 = 112,
SparkStopLossToCollateralV2 = 117,
SparkStopLossToDebtV2 = 118,
AaveBasicBuyV2 = 119,
AaveBasicSellV2 = 120,
AaveStopLossToCollateralV2_2 = 121,
AaveStopLossToDebtV2_2 = 122,
SparkStopLossToCollateralV2_2 = 123,
SparkStopLossToDebtV2_2 = 124,
}
export enum TriggerType {
StopLossToCollateral = 1,
StopLossToDai = 2,
BasicBuy = 3,
BasicSell = 4,
AutoTakeProfitToCollateral = 7,
AutoTakeProfitToDai = 8,
SimpleAAVESell = 9,
AaveStopLossToCollateral = 10,
AaveStopLossToDebt = 11,
MakerStopLossToCollateralV2 = 101,
MakerStopLossToDaiV2 = 102,
MakerBasicBuyV2 = 103,
MakerBasicSellV2 = 104,
MakerAutoTakeProfitToCollateralV2 = 105,
MakerAutoTakeProfitToDaiV2 = 106,
AaveStopLossToCollateralV2 = 111,
AaveStopLossToDebtV2 = 112,
SparkStopLossToCollateralV2 = 117,
SparkStopLossToDebtV2 = 118,
AaveBasicBuyV2 = 119,
AaveBasicSellV2 = 120,
DmaAaveStopLossToCollateralV2 = 121,
DmaAaveStopLossToDebtV2 = 122,
DmaSparkStopLossToCollateralV2 = 123,
DmaSparkStopLossToDebtV2 = 124,
}

export const triggerTypeToCommandContractTypeMap: Record<TriggerType, CommandContractType> = {
[TriggerType.StopLossToCollateral]: CommandContractType.CloseCommand,
Expand All @@ -75,12 +75,12 @@ export const triggerTypeToCommandContractTypeMap: Record<TriggerType, CommandCon
[TriggerType.AaveStopLossToDebtV2]: CommandContractType.AaveStopLossCommandV2,
[TriggerType.SparkStopLossToCollateralV2]: CommandContractType.SparkStopLossCommandV2,
[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,
[TriggerType.AaveBasicBuyV2]: CommandContractType.DmaAaveBasicBuyCommandV2,
[TriggerType.AaveBasicSellV2]: CommandContractType.DmaAaveBasicSellCommandV2,
[TriggerType.DmaAaveStopLossToCollateralV2]: CommandContractType.DmaAaveStopLossCommandV2,
[TriggerType.DmaAaveStopLossToDebtV2]: CommandContractType.DmaAaveStopLossCommandV2,
[TriggerType.DmaSparkStopLossToCollateralV2]: CommandContractType.DmaSparkStopLossCommandV2,
[TriggerType.DmaSparkStopLossToDebtV2]: CommandContractType.DmaSparkStopLossCommandV2,
};

export enum TriggerGroupType {
Expand Down

0 comments on commit b1826cd

Please sign in to comment.