@@ -5,13 +5,14 @@ import {
55 SupportedToken ,
66} from "@gearbox-protocol/sdk-gov" ;
77
8- type AdditionalTokensWithAPY = Extract <
9- SupportedToken ,
10- "STETH" | "rETH" | "osETH" | "cbETH" | "wstETH" | "sfrxETH"
11- > ;
12-
13- type AdditionalLPTokens = Extract <
8+ // all extra tokens
9+ type ExtraFarmTokens = Extract <
1410 SupportedToken ,
11+ | "STETH"
12+ | "rETH"
13+ | "osETH"
14+ | "cbETH"
15+ | "wstETH"
1516 | "weETH"
1617 | "ezETH"
1718 | "sfrxETH"
@@ -23,30 +24,24 @@ type AdditionalLPTokens = Extract<
2324 | "rstETH"
2425 | "steakLRT"
2526 | "amphrETH"
27+ | "LBTC"
2628> ;
2729
28- type ExtraFarmTokens = AdditionalTokensWithAPY | AdditionalLPTokens ;
29- export type LRTAndLSDTokens = Extract <
30+ // tokens with apy among them
31+ type ExtraTokensWithAPY = Extract <
3032 ExtraFarmTokens ,
31- | "weETH"
32- | "rsETH"
33- | "rswETH"
34- | "pufETH"
35- | "ezETH"
36- | "STETH"
37- | "wstETH"
38- | "sfrxETH"
39- | "osETH"
40- | "cbETH"
41- | "rETH"
33+ "STETH" | "rETH" | "osETH" | "cbETH" | "wstETH" | "sfrxETH"
4234> ;
4335
44- export type TokensWithAPY = LPTokens | AdditionalTokensWithAPY ;
45- export type TokensWithApyRecord = PartialRecord < TokensWithAPY , number > ;
46-
47- export type AllLPTokens = LPTokens | ExtraFarmTokens ;
36+ // LRT & LST tokens among them
37+ type LRTAndLSTTokens = Exclude < ExtraFarmTokens , "USDe" > ;
4838
49- const ADDITIONAL_LP_TOKENS : Record < AdditionalLPTokens , true > = {
39+ const EXTRA_FARM_TOKENS : Record < ExtraFarmTokens , true > = {
40+ STETH : true ,
41+ rETH : true ,
42+ osETH : true ,
43+ cbETH : true ,
44+ wstETH : true ,
5045 weETH : true ,
5146 ezETH : true ,
5247 sfrxETH : true ,
@@ -58,9 +53,15 @@ const ADDITIONAL_LP_TOKENS: Record<AdditionalLPTokens, true> = {
5853 rstETH : true ,
5954 steakLRT : true ,
6055 amphrETH : true ,
56+ LBTC : true ,
57+ } ;
58+
59+ export const isExtraFarmToken = ( t : unknown ) : t is ExtraFarmTokens => {
60+ if ( typeof t !== "string" ) return false ;
61+ return ! ! EXTRA_FARM_TOKENS [ t as ExtraFarmTokens ] ;
6162} ;
6263
63- const TOKENS_WITH_APY : Record < AdditionalTokensWithAPY , true > = {
64+ const EXTRA_TOKENS_WITH_APY : Record < ExtraTokensWithAPY , true > = {
6465 STETH : true ,
6566 osETH : true ,
6667 rETH : true ,
@@ -69,45 +70,29 @@ const TOKENS_WITH_APY: Record<AdditionalTokensWithAPY, true> = {
6970 sfrxETH : true ,
7071} ;
7172
72- const LRT_LSD : Record < LRTAndLSDTokens , true > = {
73- weETH : true ,
74- rsETH : true ,
75- rswETH : true ,
76- pufETH : true ,
77- ezETH : true ,
78- STETH : true ,
79- wstETH : true ,
80- sfrxETH : true ,
81- osETH : true ,
82- cbETH : true ,
83- rETH : true ,
84- } ;
85-
86- export const isLRT_LSDToken = ( t : unknown ) : t is LRTAndLSDTokens => {
73+ const isExtraTokenWithAPY = ( t : unknown ) : t is ExtraTokensWithAPY => {
8774 if ( typeof t !== "string" ) return false ;
88- return ! ! LRT_LSD [ t as LRTAndLSDTokens ] ;
75+ return ! ! EXTRA_TOKENS_WITH_APY [ t as ExtraTokensWithAPY ] ;
8976} ;
9077
91- export const isAdditionalLPToken = ( t : unknown ) : t is AdditionalLPTokens => {
92- if ( typeof t !== "string" ) return false ;
93- return ! ! ADDITIONAL_LP_TOKENS [ t as AdditionalLPTokens ] ;
94- } ;
78+ const { USDe, ...rest } = EXTRA_FARM_TOKENS ;
79+ const LRT_LST : Record < LRTAndLSTTokens , true > = rest ;
9580
96- export const isAdditionalTokenWithAPY = (
97- t : unknown ,
98- ) : t is AdditionalTokensWithAPY => {
81+ export const isLRT_LSTToken = ( t : unknown ) : t is LRTAndLSTTokens => {
9982 if ( typeof t !== "string" ) return false ;
100- return ! ! TOKENS_WITH_APY [ t as AdditionalTokensWithAPY ] ;
83+ return ! ! LRT_LST [ t as LRTAndLSTTokens ] ;
10184} ;
10285
103- export const isExtraFarmToken = ( t : unknown ) : t is ExtraFarmTokens =>
104- isAdditionalLPToken ( t ) || isAdditionalTokenWithAPY ( t ) ;
86+ export type TokensWithAPY = LPTokens | ExtraTokensWithAPY ;
87+ export type TokensWithApyRecord = PartialRecord < TokensWithAPY , number > ;
10588
10689export const isTokenWithAPY = ( t : unknown ) : t is TokensWithAPY => {
10790 if ( typeof t !== "string" ) return false ;
108- return isLPToken ( t ) || isAdditionalTokenWithAPY ( t ) ;
91+ return isLPToken ( t ) || isExtraTokenWithAPY ( t ) ;
10992} ;
11093
94+ export type AllLPTokens = LPTokens | ExtraFarmTokens ;
95+
11196export const isFarmToken = ( t : unknown ) : t is AllLPTokens => {
11297 return isLPToken ( t ) || isExtraFarmToken ( t ) ;
11398} ;
0 commit comments