Skip to content

Commit

Permalink
feat: common add aave bs and bb in automation package [sc-12625]
Browse files Browse the repository at this point in the history
  • Loading branch information
halaprix committed Nov 7, 2023
1 parent 5704766 commit 0d73b0e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 26 deletions.
82 changes: 64 additions & 18 deletions packages/automation/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,30 @@ export const commandTypeJsonMapping: Record<CommandContractType, string[]> = {
'executionPrice',
'maxBaseFeeInGwei',
],
[CommandContractType.AaveBasicSellCommandV2]: [
'positionAddress',
'triggerType',
'maxCoverage',
'debtToken',
'collateralToken',
'execCollRatio',
'targetCollRatio',
'minSellPrice',
'deviation',
'maxBaseFeeInGwei',
],
[CommandContractType.AaveBasicBuyCommandV2]: [
'positionAddress',
'triggerType',
'maxCoverage',
'debtToken',
'collateralToken',
'execCollRatio',
'targetCollRatio',
'maxBuyPrice',
'deviation',
'maxBaseFeeInGwei',
],
};

export const commandAddressMapping: Record<
Expand Down Expand Up @@ -228,26 +252,48 @@ export const defaultCommandTypeMapping = {
[CommandContractType.MakerStopLossCommandV2]: ['uint256', 'uint16', 'uint256', 'uint256'],
[CommandContractType.MakerAutoTakeProfitCommandV2]: ['uint256', 'uint16', 'uint256', 'uint32'],
[CommandContractType.MakerBasicBuyCommandV2]: [
'uint256',
'uint16',
'uint256',
'uint256',
'uint256',
'uint256',
'bool',
'uint64',
'uint32',
'uint256', //cdpId
'uint16', // triggerType
'uint256', // maxCoverage
'uint256', // execCollRatio
'uint256', // targetCollRatio
'uint256', // maxBuyPrice
'uint64', // deviation
'uint32', // maxBaseFeeInGwei
],
[CommandContractType.MakerBasicSellCommandV2]: [
'uint256',
'uint16',
'uint256',
'uint256',
'uint256',
'uint256',
'bool',
'uint64',
'uint32',
'uint256', //cdpId
'uint16', // triggerType
'uint256', // maxCoverage
'uint256', // execCollRatio
'uint256', // targetCollRatio
'uint256', // minSellPrice
'uint64', // deviation
'uint32', // maxBaseFeeInGwei
],
[CommandContractType.AaveBasicBuyCommandV2]: [
'address', //positionAddress
'uint16', // triggerType
'uint256', // maxCoverage
'address', // debtToken
'address', // collateralToken
'uint256', // execCollRatio
'uint256', // targetCollRatio
'uint256', // maxBuyPrice
'uint64', // deviation
'uint32', // maxBaseFeeInGwei
],
[CommandContractType.AaveBasicSellCommandV2]: [
'address', //positionAddress
'uint16', // triggerType
'uint256', // maxCoverage
'address', // debtToken
'address', // collateralToken
'uint256', // execCollRatio
'uint256', // targetCollRatio
'uint256', // minSellPrice
'uint64', // deviation
'uint32', // maxBaseFeeInGwei
],
} as const;

Expand Down
12 changes: 4 additions & 8 deletions packages/automation/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export enum CommandContractType {
MakerBasicBuyCommandV2 = 'MakerBasicBuyCommandV2',
MakerBasicSellCommandV2 = 'MakerBasicSellCommandV2',
SparkStopLossCommandV2 = 'SparkStopLossCommandV2',
AaveBasicBuyCommandV2 = 'AaveBasicBuyCommandV2',
AaveBasicSellCommandV2 = 'AaveBasicSellCommandV2',
}

export enum TriggerType {
Expand All @@ -37,18 +39,12 @@ export enum TriggerType {
MakerBasicSellV2 = 104,
MakerAutoTakeProfitToCollateralV2 = 105,
MakerAutoTakeProfitToDaiV2 = 106,
// AaveStopLossToCollateralV2 = 107,
// AaveStopLossToDebtV2 = 108,
// AaveStopLossToCollateralV2 = 109,
// AaveStopLossToDebtV2 = 110,
AaveStopLossToCollateralV2 = 111,
AaveStopLossToDebtV2 = 112,
// SparkStopLossToCollateralV2 = 113,
// SparkStopLossToDebtV2 = 114,
// SparkStopLossToCollateralV2 = 115,
// SparkStopLossToDebtV2 = 116,
SparkStopLossToCollateralV2 = 117,
SparkStopLossToDebtV2 = 118,
AaveBasicBuyV2 = 119,
AaceBasicSellV2 = 120,
}

export enum TriggerGroupType {
Expand Down

0 comments on commit 0d73b0e

Please sign in to comment.