Skip to content

Commit

Permalink
feat: add entries or placeholders for Morpho
Browse files Browse the repository at this point in the history
  • Loading branch information
zerotucks committed Apr 26, 2024
1 parent 5be6122 commit 45553e0
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions packages/automation/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,36 @@ export const commandTypeJsonMapping: Record<CommandContractType, string[]> = {
'deviation',
'withdrawToDebt',
],

// Morpho
[CommandContractType.DmaMorphoBlueBasicBuyCommandV2]: [
'positionAddress',
'triggerType',
'maxCoverage',
'debtToken',
'collateralToken',
'operationName',
'id',
'quoteDecimals',
'collateralDecimals',
'executionLtv',
'targetLtv',
'maxBuyPrice',
'deviation',
'maxBaseFeeInGwei',
],
[CommandContractType.DmaMorphoBlueBasicSellCommandV2]: [
// TODO
],
[CommandContractType.DmaMorphoBlueStopLossCommandV2]: [
// TODO
],
[CommandContractType.DmaMorphoBluePartialTakeProfitCommandV2]: [
// TODO
],
[CommandContractType.DmaMorphoBlueTrailingStopLossCommandV2]: [
// TODO
],
};
export const commandOffchainDataTypeJsonMapping: Partial<Record<CommandContractType, string[]>> = {
[CommandContractType.DmaAaveTrailingStopLossCommandV2]: [
Expand All @@ -234,6 +264,11 @@ export const commandOffchainDataTypeJsonMapping: Partial<Record<CommandContractT
'debtClosestPriceRoundId',
'debtNextPriceRoundId',
],
[CommandContractType.DmaMorphoBlueTrailingStopLossCommandV2]: [
'collateralMaxPriceRoundId',
'debtClosestPriceRoundId',
'debtNextPriceRoundId',
],
};
export const commandAddressMapping: Record<
number,
Expand Down Expand Up @@ -345,6 +380,23 @@ export const commandAddressMapping: Record<
'0x739838d896B50703968e43876f2D43885C9ff8aD': {
type: CommandContractType.DmaAavePartialTakeProfitCommandV2,
},

// TODO: Add addresses once deployed
'0xUpdateMe': {
type: CommandContractType.DmaMorphoBlueBasicBuyCommandV2,
},
'0xUpdateMe2': {
type: CommandContractType.DmaMorphoBlueBasicSellCommandV2,
},
'0xUpdateMe3': {
type: CommandContractType.DmaMorphoBluePartialTakeProfitCommandV2,
},
'0xUpdateMe4': {
type: CommandContractType.DmaMorphoBlueStopLossCommandV2,
},
'0xUpdateMe5': {
type: CommandContractType.DmaMorphoBlueTrailingStopLossCommandV2,
},
},
[EthereumNetwork.BASE]: {
'0xb7CB13e4cD2D64e739b5746563978Ab7ee36B064': {
Expand Down Expand Up @@ -601,6 +653,36 @@ export const defaultCommandTypeMapping: Record<CommandContractType, ParamDefinit
'uint64', // deviation
'bool', // closeToCollateral
],

// Morpho
[CommandContractType.DmaMorphoBlueBasicBuyCommandV2]: [
'address', //positionAddress
'uint16', // triggerType
'uint256', // maxCoverage
'address', // debtToken
'address', // collateralToken
'bytes32', // operationName
'bytes32', // Id
'uint8', // quoteDecimals
'uint8', // collateralDecimals
'uint256', // execLtv
'uint256', // targetLtv
'uint256', // maxBuyPrice
'uint64', // deviation
'uint32', // maxBaseFeeInGwei
],
[CommandContractType.DmaMorphoBlueBasicSellCommandV2]: [
// TODO
],
[CommandContractType.DmaMorphoBlueStopLossCommandV2]: [
// TODO
],
[CommandContractType.DmaMorphoBluePartialTakeProfitCommandV2]: [
// TODO
],
[CommandContractType.DmaMorphoBlueTrailingStopLossCommandV2]: [
// TODO
],
} as const;

export const defaultCommandOffchainDataTypeMapping: Partial<Record<
Expand All @@ -617,6 +699,11 @@ export const defaultCommandOffchainDataTypeMapping: Partial<Record<
'uint80', // debtClosestPriceRoundId
'uint80', // debtNextPriceRoundId
],
[CommandContractType.DmaMorphoBlueTrailingStopLossCommandV2]: [
'uint80', // collateralMaxPriceRoundId
'uint80', // debtClosestPriceRoundId
'uint80', // debtNextPriceRoundId
],
} as const;

export function getCommandAddresses(network: number): Record<CommandContractType, string[]> {
Expand Down

0 comments on commit 45553e0

Please sign in to comment.