Skip to content

Commit c67dce3

Browse files
authored
feat: Vault liquidation by address (#623)
1 parent 02a0f1c commit c67dce3

18 files changed

+180
-90
lines changed

core/src/constants/COLLATERALS.ts

+47
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
2222
symbol: 'AAVE',
2323
tokenName: 'AAVE',
2424
decimals: 18,
25+
isActive: false,
2526
contracts: {
2627
token: 'AAVE',
2728
pip: 'PIP_AAVE',
@@ -51,6 +52,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
5152
symbol: 'BAL',
5253
tokenName: 'BAL',
5354
decimals: 18,
55+
isActive: false,
5456
contracts: {
5557
token: 'BAL',
5658
pip: 'PIP_BAL',
@@ -80,6 +82,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
8082
symbol: 'BAT',
8183
tokenName: 'BAT',
8284
decimals: 18,
85+
isActive: false,
8386
contracts: {
8487
token: 'BAT',
8588
pip: 'PIP_BAT',
@@ -109,6 +112,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
109112
symbol: 'COMP',
110113
tokenName: 'COMP',
111114
decimals: 18,
115+
isActive: false,
112116
contracts: {
113117
token: 'COMP',
114118
pip: 'PIP_COMP',
@@ -138,6 +142,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
138142
symbol: 'GNO',
139143
tokenName: 'GNO',
140144
decimals: 18,
145+
isActive: false,
141146
contracts: {
142147
token: 'GNO',
143148
pip: 'PIP_GNO',
@@ -163,6 +168,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
163168
symbol: 'ETH',
164169
tokenName: 'ETH',
165170
decimals: 18,
171+
isActive: true,
166172
contracts: {
167173
token: 'ETH',
168174
pip: 'PIP_ETH',
@@ -192,6 +198,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
192198
symbol: 'ETH',
193199
tokenName: 'ETH',
194200
decimals: 18,
201+
isActive: true,
195202
contracts: {
196203
token: 'ETH',
197204
pip: 'PIP_ETH',
@@ -221,6 +228,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
221228
symbol: 'ETH',
222229
tokenName: 'ETH',
223230
decimals: 18,
231+
isActive: true,
224232
contracts: {
225233
token: 'ETH',
226234
pip: 'PIP_ETH',
@@ -250,6 +258,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
250258
symbol: 'GUSD',
251259
tokenName: 'GUSD',
252260
decimals: 2,
261+
isActive: false,
253262
contracts: {
254263
token: 'GUSD',
255264
pip: 'PIP_GUSD',
@@ -279,6 +288,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
279288
symbol: 'KNC',
280289
tokenName: 'KNC',
281290
decimals: 18,
291+
isActive: false,
282292
contracts: {
283293
token: 'KNC',
284294
pip: 'PIP_KNC',
@@ -308,6 +318,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
308318
symbol: 'LINK',
309319
tokenName: 'LINK',
310320
decimals: 18,
321+
isActive: false,
311322
contracts: {
312323
token: 'LINK',
313324
pip: 'PIP_LINK',
@@ -337,6 +348,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
337348
symbol: 'LRC',
338349
tokenName: 'LRC',
339350
decimals: 18,
351+
isActive: false,
340352
contracts: {
341353
token: 'LRC',
342354
pip: 'PIP_LRC',
@@ -366,6 +378,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
366378
symbol: 'MANA',
367379
tokenName: 'MANA',
368380
decimals: 18,
381+
isActive: false,
369382
contracts: {
370383
token: 'MANA',
371384
pip: 'PIP_MANA',
@@ -395,6 +408,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
395408
symbol: 'PAXUSD',
396409
tokenName: 'PAXUSD',
397410
decimals: 18,
411+
isActive: false,
398412
contracts: {
399413
token: 'PAXUSD',
400414
pip: 'PIP_PAXUSD',
@@ -425,6 +439,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
425439
symbol: 'RENBTC',
426440
tokenName: 'RENBTC',
427441
decimals: 8,
442+
isActive: false,
428443
contracts: {
429444
token: 'RENBTC',
430445
pip: 'PIP_RENBTC',
@@ -454,6 +469,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
454469
symbol: 'TUSD',
455470
tokenName: 'TUSD',
456471
decimals: 18,
472+
isActive: false,
457473
contracts: {
458474
token: 'TUSD',
459475
pip: 'PIP_TUSD',
@@ -483,6 +499,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
483499
symbol: 'UNI',
484500
tokenName: 'UNI',
485501
decimals: 18,
502+
isActive: false,
486503
contracts: {
487504
token: 'UNI',
488505
pip: 'PIP_UNI',
@@ -512,6 +529,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
512529
symbol: 'USDC',
513530
tokenName: 'USDC',
514531
decimals: 6,
532+
isActive: false,
515533
contracts: {
516534
token: 'USDC',
517535
pip: 'PIP_USDC',
@@ -541,6 +559,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
541559
symbol: 'USDC',
542560
tokenName: 'USDC',
543561
decimals: 6,
562+
isActive: false,
544563
contracts: {
545564
token: 'USDC',
546565
pip: 'PIP_USDC',
@@ -570,6 +589,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
570589
symbol: 'USDT',
571590
tokenName: 'USDT',
572591
decimals: 6,
592+
isActive: false,
573593
contracts: {
574594
token: 'USDT',
575595
pip: 'PIP_USDT',
@@ -599,6 +619,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
599619
symbol: 'WBTC',
600620
tokenName: 'WBTC',
601621
decimals: 8,
622+
isActive: true,
602623
contracts: {
603624
token: 'WBTC',
604625
pip: 'PIP_WBTC',
@@ -628,6 +649,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
628649
symbol: 'WBTC',
629650
tokenName: 'WBTC',
630651
decimals: 8,
652+
isActive: true,
631653
contracts: {
632654
token: 'WBTC',
633655
pip: 'PIP_WBTC',
@@ -657,6 +679,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
657679
symbol: 'WBTC',
658680
tokenName: 'WBTC',
659681
decimals: 8,
682+
isActive: true,
660683
contracts: {
661684
token: 'WBTC',
662685
pip: 'PIP_WBTC',
@@ -686,6 +709,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
686709
symbol: 'YFI',
687710
tokenName: 'YFI',
688711
decimals: 18,
712+
isActive: false,
689713
contracts: {
690714
token: 'YFI',
691715
pip: 'PIP_YFI',
@@ -715,6 +739,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
715739
symbol: 'ZRX',
716740
tokenName: 'ZRX',
717741
decimals: 18,
742+
isActive: false,
718743
contracts: {
719744
token: 'ZRX',
720745
pip: 'PIP_ZRX',
@@ -744,6 +769,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
744769
symbol: 'MATIC',
745770
tokenName: 'MATIC',
746771
decimals: 18,
772+
isActive: false,
747773
contracts: {
748774
token: 'MATIC',
749775
pip: 'PIP_MATIC',
@@ -773,6 +799,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
773799
symbol: 'WSTETH',
774800
tokenName: 'WSTETH',
775801
decimals: 18,
802+
isActive: true,
776803
contracts: {
777804
token: 'WSTETH',
778805
pip: 'PIP_WSTETH',
@@ -794,6 +821,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
794821
symbol: 'WSTETH',
795822
tokenName: 'WSTETH',
796823
decimals: 18,
824+
isActive: true,
797825
contracts: {
798826
token: 'WSTETH',
799827
pip: 'PIP_WSTETH',
@@ -815,6 +843,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
815843
symbol: 'CRVV1ETHSTETH',
816844
tokenName: 'CRVV1ETHSTETH',
817845
decimals: 18,
846+
isActive: false,
818847
contracts: {
819848
token: 'CRVV1ETHSTETH',
820849
pip: 'PIP_CRVV1ETHSTETH',
@@ -836,6 +865,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
836865
symbol: 'UNIV2DAIETH',
837866
tokenName: 'UNIV2DAIETH',
838867
decimals: 18,
868+
isActive: false,
839869
contracts: {
840870
token: 'UNIV2DAIETH',
841871
pip: 'PIP_UNIV2DAIETH',
@@ -858,6 +888,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
858888
symbol: 'UNIV2USDCETH',
859889
tokenName: 'UNIV2USDCETH',
860890
decimals: 18,
891+
isActive: false,
861892
contracts: {
862893
token: 'UNIV2USDCETH',
863894
pip: 'PIP_UNIV2USDCETH',
@@ -880,6 +911,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
880911
symbol: 'UNIV2ETHUSDT',
881912
tokenName: 'UNIV2ETHUSDT',
882913
decimals: 18,
914+
isActive: false,
883915
contracts: {
884916
token: 'UNIV2ETHUSDT',
885917
pip: 'PIP_UNIV2ETHUSDT',
@@ -902,6 +934,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
902934
symbol: 'UNIV2WBTCDAI',
903935
tokenName: 'UNIV2WBTCDAI',
904936
decimals: 18,
937+
isActive: false,
905938
contracts: {
906939
token: 'UNIV2WBTCDAI',
907940
pip: 'PIP_UNIV2WBTCDAI',
@@ -924,6 +957,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
924957
symbol: 'UNIV2WBTCETH',
925958
tokenName: 'UNIV2WBTCETH',
926959
decimals: 18,
960+
isActive: false,
927961
contracts: {
928962
token: 'UNIV2WBTCETH',
929963
pip: 'PIP_UNIV2WBTCETH',
@@ -946,6 +980,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
946980
symbol: 'UNIV2LINKETH',
947981
tokenName: 'UNIV2LINKETH',
948982
decimals: 18,
983+
isActive: false,
949984
contracts: {
950985
token: 'UNIV2LINKETH',
951986
pip: 'PIP_UNIV2LINKETH',
@@ -968,6 +1003,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
9681003
symbol: 'UNIV2UNIETH',
9691004
tokenName: 'UNIV2UNIETH',
9701005
decimals: 18,
1006+
isActive: false,
9711007
contracts: {
9721008
token: 'UNIV2UNIETH',
9731009
pip: 'PIP_UNIV2UNIETH',
@@ -990,6 +1026,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
9901026
symbol: 'UNIV2AAVEETH',
9911027
tokenName: 'UNIV2AAVEETH',
9921028
decimals: 18,
1029+
isActive: false,
9931030
contracts: {
9941031
token: 'UNIV2AAVEETH',
9951032
pip: 'PIP_UNIV2AAVEETH',
@@ -1012,6 +1049,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
10121049
symbol: 'UNIV2DAIUSDT',
10131050
tokenName: 'UNIV2DAIUSDT',
10141051
decimals: 18,
1052+
isActive: false,
10151053
contracts: {
10161054
token: 'UNIV2DAIUSDT',
10171055
pip: 'PIP_UNIV2DAIUSDT',
@@ -1034,6 +1072,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
10341072
symbol: 'UNIV2DAIUSDC',
10351073
tokenName: 'UNIV2DAIUSDC',
10361074
decimals: 18,
1075+
isActive: false,
10371076
contracts: {
10381077
token: 'UNIV2DAIUSDC',
10391078
pip: 'PIP_UNIV2DAIUSDC',
@@ -1056,6 +1095,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
10561095
symbol: 'RETH',
10571096
tokenName: 'RETH',
10581097
decimals: 18,
1098+
isActive: false,
10591099
contracts: {
10601100
token: 'RETH',
10611101
pip: 'PIP_RETH',
@@ -1077,6 +1117,7 @@ const COLLATERALS: Record<string, CollateralConfig> = {
10771117
symbol: 'MCD_GOV',
10781118
tokenName: 'MKR',
10791119
decimals: 18,
1120+
isActive: true,
10801121
contracts: {
10811122
token: 'MCD_GOV',
10821123
pip: 'PIP_MKR',
@@ -1118,4 +1159,10 @@ export const getAllCollateralTypes = function (): string[] {
11181159
return Object.keys(COLLATERALS).sort();
11191160
};
11201161

1162+
export const getActiveCollateralTypes = function (): string[] {
1163+
return Object.values(COLLATERALS)
1164+
.filter(config => config.isActive)
1165+
.map(config => config.ilk);
1166+
};
1167+
11211168
export default COLLATERALS;

core/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export declare interface CollateralConfig {
169169
symbol: string;
170170
tokenName: string;
171171
decimals: number;
172+
isActive: boolean;
172173
exchanges: Record<string, CalleeConfig>;
173174
oracle: CollateralPriceSourceConfig;
174175
contracts: CollateralAddresses;
@@ -405,7 +406,6 @@ export declare interface VaultCollateralParameters {
405406
}
406407

407408
export declare interface VaultBase {
408-
id: number;
409409
address: string;
410410
collateralType: CollateralType;
411411
network: string;

0 commit comments

Comments
 (0)