@@ -20,7 +20,7 @@ export type DeFiProtocol = {
20
20
coreContracts ?: string [ ]
21
21
}
22
22
23
- export enum IntegrationStatus {
23
+ export const enum IntegrationStatus {
24
24
LIVE = 'Live' ,
25
25
IN_USE = 'In use' ,
26
26
BEING_DEPLOYED = 'Being deployed' ,
@@ -44,54 +44,6 @@ export enum DefiCategory {
44
44
LST = 'Liquid staking' ,
45
45
}
46
46
47
- export const getIntegrationStatus = ( p : DeFiProtocol ) : IntegrationStatus => {
48
- if ( p . coreContracts && p . coreContracts . length > 0 ) {
49
- return IntegrationStatus . LIVE
50
- }
51
- if ( p . adapters && p . adapters . length > 0 ) {
52
- return IntegrationStatus . LIVE
53
- }
54
- if ( p . strategies ) {
55
- for ( const strategy of p . strategies ) {
56
- if ( strategies [ strategy ] ?. state == StrategyState . LIVE ) {
57
- return IntegrationStatus . LIVE
58
- }
59
- if ( strategies [ strategy ] ?. state == StrategyState . AWAITING_DEPLOYMENT ) {
60
- return IntegrationStatus . BEING_DEPLOYED
61
- }
62
- if ( strategies [ strategy ] ?. state == StrategyState . DEVELOPMENT ) {
63
- return IntegrationStatus . DEVELOPMENT
64
- }
65
- if ( strategies [ strategy ] ?. state == StrategyState . PROPOSED ) {
66
- return IntegrationStatus . AWAITING
67
- }
68
- }
69
- }
70
- if ( p . intermediaryStrategies ) {
71
- for ( const strategy of p . intermediaryStrategies ) {
72
- if ( strategies [ strategy ] ?. state == StrategyState . LIVE ) {
73
- return IntegrationStatus . IN_USE
74
- }
75
- if ( strategies [ strategy ] ?. state == StrategyState . AWAITING_DEPLOYMENT ) {
76
- return IntegrationStatus . BEING_DEPLOYED
77
- }
78
- if ( strategies [ strategy ] ?. state == StrategyState . DEVELOPMENT ) {
79
- return IntegrationStatus . DEVELOPMENT
80
- }
81
- if ( strategies [ strategy ] ?. state == StrategyState . PROPOSED ) {
82
- return IntegrationStatus . AWAITING
83
- }
84
- }
85
- }
86
- const supportedNetWorkIds = Object . keys ( deployments ) . map ( chainIdString => networks [ chainIdString ] . id )
87
- for ( const protocolNetworkId of p . networks ) {
88
- if ( supportedNetWorkIds . includes ( protocolNetworkId as NetworkId ) ) {
89
- return IntegrationStatus . POSSIBLE
90
- }
91
- }
92
- return IntegrationStatus . PROPOSED
93
- }
94
-
95
47
export const integrations : { [ org : string ] : DeFiOrganization } = {
96
48
// oracle
97
49
chainlink : {
@@ -655,3 +607,51 @@ export const integrations: { [org: string]: DeFiOrganization } = {
655
607
defiLlama : 'stader' ,
656
608
} ,
657
609
} ;
610
+
611
+ export const getIntegrationStatus = ( p : DeFiProtocol ) : IntegrationStatus => {
612
+ if ( p . coreContracts && p . coreContracts . length > 0 ) {
613
+ return IntegrationStatus . LIVE
614
+ }
615
+ if ( p . adapters && p . adapters . length > 0 ) {
616
+ return IntegrationStatus . LIVE
617
+ }
618
+ if ( p . strategies ) {
619
+ for ( const strategy of p . strategies ) {
620
+ if ( strategies [ strategy ] ?. state == StrategyState . LIVE ) {
621
+ return IntegrationStatus . LIVE
622
+ }
623
+ if ( strategies [ strategy ] ?. state == StrategyState . AWAITING_DEPLOYMENT ) {
624
+ return IntegrationStatus . BEING_DEPLOYED
625
+ }
626
+ if ( strategies [ strategy ] ?. state == StrategyState . DEVELOPMENT ) {
627
+ return IntegrationStatus . DEVELOPMENT
628
+ }
629
+ if ( strategies [ strategy ] ?. state == StrategyState . PROPOSED ) {
630
+ return IntegrationStatus . AWAITING
631
+ }
632
+ }
633
+ }
634
+ if ( p . intermediaryStrategies ) {
635
+ for ( const strategy of p . intermediaryStrategies ) {
636
+ if ( strategies [ strategy ] ?. state == StrategyState . LIVE ) {
637
+ return IntegrationStatus . IN_USE
638
+ }
639
+ if ( strategies [ strategy ] ?. state == StrategyState . AWAITING_DEPLOYMENT ) {
640
+ return IntegrationStatus . BEING_DEPLOYED
641
+ }
642
+ if ( strategies [ strategy ] ?. state == StrategyState . DEVELOPMENT ) {
643
+ return IntegrationStatus . DEVELOPMENT
644
+ }
645
+ if ( strategies [ strategy ] ?. state == StrategyState . PROPOSED ) {
646
+ return IntegrationStatus . AWAITING
647
+ }
648
+ }
649
+ }
650
+ const supportedNetWorkIds = Object . keys ( deployments ) . map ( chainIdString => networks [ chainIdString ] . id )
651
+ for ( const protocolNetworkId of p . networks ) {
652
+ if ( supportedNetWorkIds . includes ( protocolNetworkId as NetworkId ) ) {
653
+ return IntegrationStatus . POSSIBLE
654
+ }
655
+ }
656
+ return IntegrationStatus . PROPOSED
657
+ }
0 commit comments