Commit 145381f 1 parent e7c52d2 commit 145381f Copy full SHA for 145381f
File tree 4 files changed +10
-8
lines changed
4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -3,5 +3,4 @@ export const emptyAutomations = {
3
3
autoBuy : { enabled : false } ,
4
4
autoSell : { enabled : false } ,
5
5
stopLoss : { enabled : false } ,
6
- takeProfit : { enabled : false } ,
7
6
}
Original file line number Diff line number Diff line change @@ -127,13 +127,14 @@ export const commonDataMapper = ({
127
127
} [ dpm . protocol ]
128
128
} /${ dpm . vaultId } `,
129
129
automations : {
130
- ...( dpm . positionType !== OmniProductType . Earn && automations
130
+ ...( dpm . positionType !== OmniProductType . Earn
131
131
? {
132
132
...getPositionsAutomations ( {
133
- triggers : [ automations . triggers ] ,
133
+ triggers : automations ? [ automations . triggers ] : [ ] ,
134
+ defaultList : dpm . protocol !== 'AAVE' ? emptyAutomations : { } ,
134
135
} ) ,
135
136
}
136
- : emptyAutomations ) ,
137
+ : { } ) ,
137
138
} ,
138
139
} ,
139
140
primaryTokenPrice : primaryTokenOraclePrice || primaryTokenTickerPrice ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const automationQuery = gql`
12
12
executedBlock
13
13
removedBlock
14
14
triggerData
15
+ triggerType
15
16
owner
16
17
}
17
18
}
Original file line number Diff line number Diff line change 1
1
import { TriggerType } from '@oasisdex/automation'
2
- import { emptyAutomations } from 'handlers/portfolio/constants'
3
2
import type { MakerDiscoverPositionsTrigger } from 'handlers/portfolio/positions/handlers/maker/types'
4
3
import type { PortfolioPositionAutomations } from 'handlers/portfolio/types'
5
4
6
- interface getPositionsAutomationsParams {
5
+ interface GetPositionsAutomationsParams {
7
6
triggers : MakerDiscoverPositionsTrigger [ ]
7
+ defaultList ?: Record < string , boolean > | { }
8
8
}
9
9
10
10
const triggerTypesMap = {
@@ -41,7 +41,8 @@ const triggerTypesMap = {
41
41
42
42
export function getPositionsAutomations ( {
43
43
triggers,
44
- } : getPositionsAutomationsParams ) : PortfolioPositionAutomations {
44
+ defaultList = { } ,
45
+ } : GetPositionsAutomationsParams ) : PortfolioPositionAutomations {
45
46
return triggers
46
47
. filter ( ( { executedBlock, removedBlock } ) => executedBlock === null && removedBlock === null )
47
48
. reduce ( ( automations , { triggerType } ) => {
@@ -59,5 +60,5 @@ export function getPositionsAutomations({
59
60
{ } ,
60
61
) ,
61
62
}
62
- } , emptyAutomations )
63
+ } , defaultList )
63
64
}
You can’t perform that action at this time.
0 commit comments