From 9e790642bae0198fb70c4064f08ed18c122edfe8 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 09:12:44 +0100 Subject: [PATCH 01/17] feat: create token config --- configs/token/index.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 configs/token/index.ts diff --git a/configs/token/index.ts b/configs/token/index.ts new file mode 100644 index 0000000..cc115fc --- /dev/null +++ b/configs/token/index.ts @@ -0,0 +1,18 @@ +import {ConfigHelperType} from "⌨️"; +// import { getFeatures } from "./getFeatures"; +// import { getNavigation } from "./getNavigation"; +// import { getParameters } from "./getParameters"; +// import { getRpcConfig } from "./getRpcConfig"; + +export default function ({ + isDevelopment: _isDevelopment, + notProduction, + isStaging, + }: ConfigHelperType) { + return { + // features: getFeatures({ isStaging }), + // parameters: getParameters({ notProduction }), + // navigation: getNavigation(), + // rpcConfig: getRpcConfig({ notProduction }), + }; +} From 7ebfb0dd20031fcb1fc045458119201e7801fd26 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 09:21:39 +0100 Subject: [PATCH 02/17] feat: create getTokens function --- configs/domain/getTokens.ts | 39 ++++++++++++++++++++++++++++++ configs/{token => domain}/index.ts | 14 ++++++++--- 2 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 configs/domain/getTokens.ts rename configs/{token => domain}/index.ts (61%) diff --git a/configs/domain/getTokens.ts b/configs/domain/getTokens.ts new file mode 100644 index 0000000..b944ba5 --- /dev/null +++ b/configs/domain/getTokens.ts @@ -0,0 +1,39 @@ +import { ConfigHelperType } from "⌨️"; + +export const getTokens = ({ + isStaging, + }: Pick) => ({ + AaveV3ArbitrumBorrow: true, + AaveV3ArbitrumEarn: false, + AaveV3EarncbETHeth: false, + AaveV3EarnrETHeth: false, + AaveV3History: false, + AaveV3OptimismBorrow: true, + AaveV3OptimismEarn: false, + AaveV3Protection: true, + AaveV3ProtectionWrite: true, + AjnaPoolFinder: true, + AjnaReusableDPM: false, + AjnaSafetySwitch: true, + AjnaSuppressValidation: false, + AnotherTestFeature: true, // used in unit tests + ConstantMultipleReadOnly: false, + DaiSavingsRate: true, + DisableSidebarScroll: false, + FollowAAVEVaults: false, + NewNavigation: true, + ProxyCreationDisabled: false, + ProxyReveal: false, + ReadOnlyAutoTakeProfit: false, + ReadOnlyBasicBS: false, + Referrals: true, + Sillyness: false, + StopLossOpenFlow: false, + StopLossRead: true, + StopLossWrite: true, + TestFeature: false, // used in unit tests + UseNetworkSwitcherForks: false, + UseNetworkSwitcherTestnets: false, + SparkProtocolStopLoss: isStaging, + UseRpcGateway: false, +}); diff --git a/configs/token/index.ts b/configs/domain/index.ts similarity index 61% rename from configs/token/index.ts rename to configs/domain/index.ts index cc115fc..44581f9 100644 --- a/configs/token/index.ts +++ b/configs/domain/index.ts @@ -4,15 +4,21 @@ import {ConfigHelperType} from "⌨️"; // import { getParameters } from "./getParameters"; // import { getRpcConfig } from "./getRpcConfig"; + export default function ({ isDevelopment: _isDevelopment, notProduction, isStaging, }: ConfigHelperType) { + /** + * Goal is to capture domain specific configurations that is common + * across all Summer.fi systems and apps. + * + * Possible extensions could include Products / Product categories / Strategies etc + */ return { - // features: getFeatures({ isStaging }), - // parameters: getParameters({ notProduction }), - // navigation: getNavigation(), - // rpcConfig: getRpcConfig({ notProduction }), + tokens: null, + lendingProtocols: null, + networks: null, }; } From c8bbbdeff3737b05a493061700f99604725b0b28 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 09:53:29 +0100 Subject: [PATCH 03/17] feat: create common configuration for Tokens --- common/index.ts | 3 + common/networks.ts | 10 +++ common/token-symbols.ts | 62 ++++++++++++++++ common/tokens.ts | 140 ++++++++++++++++++++++++++++++++++++ configs/domain/getTokens.ts | 51 +++++-------- 5 files changed, 232 insertions(+), 34 deletions(-) create mode 100644 common/index.ts create mode 100644 common/networks.ts create mode 100644 common/token-symbols.ts create mode 100644 common/tokens.ts diff --git a/common/index.ts b/common/index.ts new file mode 100644 index 0000000..a97d1de --- /dev/null +++ b/common/index.ts @@ -0,0 +1,3 @@ +export * from './networks'; +export * from './token-symbols' +export * from './tokens'; diff --git a/common/networks.ts b/common/networks.ts new file mode 100644 index 0000000..a52b2b7 --- /dev/null +++ b/common/networks.ts @@ -0,0 +1,10 @@ +export enum Network { + MAINNET = 'mainnet', + GOERLI = 'goerli', + HARDHAT = 'hardhat', + OPTIMISM = 'optimism', + ARBITRUM = 'arbitrum', + BASE = 'base', + LOCAL = 'local', + TENDERLY = 'tenderly', +} diff --git a/common/token-symbols.ts b/common/token-symbols.ts new file mode 100644 index 0000000..befcd8b --- /dev/null +++ b/common/token-symbols.ts @@ -0,0 +1,62 @@ +export enum TokenSymbols { + ETH = 'ETH', + WETH = 'WETH', + STETH = 'STETH', + WSTETH = 'WSTETH', + WBTC = 'WBTC', + USDC = 'USDC', + DAI = 'DAI', + CBETH = 'CBETH', + RETH = 'RETH', + AAVE = 'AAVE', + LINK = 'LINK', + UNI = 'UNI', + SUSHI = 'SUSHI', + CRV = 'CRV', + SNX = 'SNX', + ADAI = 'ADAI', + BAL = 'BAL', + BAT = 'BAT', + COMP = 'COMP', + CRVV1ETHSTETH = 'CRVV1ETHSTETH', + FRAX = 'FRAX', + GHO = 'GHO', + GNO = 'GNO', + GUNIV3DAIUSDC1 = 'GUNIV3DAIUSDC1', + GUNIV3DAIUSDC2 = 'GUNIV3DAIUSDC2', + GUSD = 'GUSD', + KNC = 'KNC', + LDO = 'LDO', + LRC = 'LRC', + LUSD = 'LUSD', + MANA = 'MANA', + MATIC = 'MATIC', + PAX = 'PAX', + PAXUSD = 'PAXUSD', + RENBTC = 'RENBTC', + RWA001 = 'RWA001', + RWA002 = 'RWA002', + RWA003 = 'RWA003', + RWA004 = 'RWA004', + RWA005 = 'RWA005', + RWA006 = 'RWA006', + SDAI = 'SDAI', + TBTC = 'TBTC', + TUSD = 'TUSD', + UNIV2AAVEETH = 'UNIV2AAVEETH', + UNIV2DAIETH = 'UNIV2DAIETH', + UNIV2DAIUSDC = 'UNIV2DAIUSDC', + UNIV2DAIUSDT = 'UNIV2DAIUSDT', + UNIV2ETHUSDT = 'UNIV2ETHUSDT', + UNIV2LINKETH = 'UNIV2LINKETH', + UNIV2UNIETH = 'UNIV2UNIETH', + UNIV2USDCETH = 'UNIV2USDCETH', + UNIV2WBTCDAI = 'UNIV2WBTCDAI', + UNIV2WBTCETH = 'UNIV2WBTCETH', + USDT = 'USDT', + WLD = 'WLD', + YIELDBTC = 'YIELDBTC', + YIELDETH = 'YIELDETH', + YFI = 'YFI', + ZRX = 'ZRX', +} diff --git a/common/tokens.ts b/common/tokens.ts new file mode 100644 index 0000000..4234b20 --- /dev/null +++ b/common/tokens.ts @@ -0,0 +1,140 @@ +import {TokenSymbols} from "./token-symbols"; + +interface IToken { + symbol: TokenSymbols + precision: number +} + +class Token implements IToken { + symbol: TokenSymbols + precision: number + + constructor(symbol: TokenSymbols, precision: number) { + this.symbol = symbol + this.precision = precision + } +} + +const ETH = new Token(TokenSymbols.ETH, 18) +const WETH = new Token(TokenSymbols.WETH, 18) +const STETH = new Token(TokenSymbols.STETH, 18) +const WSTETH = new Token(TokenSymbols.WSTETH, 18) +const WBTC = new Token(TokenSymbols.WBTC, 8) +const USDC = new Token(TokenSymbols.USDC, 6) +const DAI = new Token(TokenSymbols.DAI, 18) +const CBETH = new Token(TokenSymbols.CBETH, 8) +const RETH = new Token(TokenSymbols.RETH, 8) +const AAVE = new Token(TokenSymbols.AAVE, 18) +const LINK = new Token(TokenSymbols.LINK, 18) +const UNI = new Token(TokenSymbols.UNI, 18) +const SUSHI = new Token(TokenSymbols.SUSHI, 18) +const CRV = new Token(TokenSymbols.CRV, 18) +const SNX = new Token(TokenSymbols.SNX, 18) +const ADAI = new Token(TokenSymbols.ADAI, 18) +const BAL = new Token(TokenSymbols.BAL, 18) +const BAT = new Token(TokenSymbols.BAT, 18) +const COMP = new Token(TokenSymbols.COMP, 18) +const CRVV1ETHSTETH = new Token(TokenSymbols.CRVV1ETHSTETH, 18) +const FRAX = new Token(TokenSymbols.FRAX, 18) +const GHO = new Token(TokenSymbols.GHO, 18) +const GNO = new Token(TokenSymbols.GNO, 18) +const GUNIV3DAIUSDC1 = new Token(TokenSymbols.GUNIV3DAIUSDC1, 18) +const GUNIV3DAIUSDC2 = new Token(TokenSymbols.GUNIV3DAIUSDC2, 18) +const GUSD = new Token(TokenSymbols.GUSD, 2) +const KNC = new Token(TokenSymbols.KNC, 18) +const LDO = new Token(TokenSymbols.LDO, 18) +const LRC = new Token(TokenSymbols.LRC, 18) +const LUSD = new Token(TokenSymbols.LUSD, 18) +const MANA = new Token(TokenSymbols.MANA, 18) +const MATIC = new Token(TokenSymbols.MATIC, 18) +const PAX = new Token(TokenSymbols.PAX, 18) +const PAXUSD = new Token(TokenSymbols.PAXUSD, 18) +const RENBTC = new Token(TokenSymbols.RENBTC, 8) +const RWA001 = new Token(TokenSymbols.RWA001, 18) +const RWA002 = new Token(TokenSymbols.RWA002, 18) +const RWA003 = new Token(TokenSymbols.RWA003, 18) +const RWA004 = new Token(TokenSymbols.RWA004, 18) +const RWA005 = new Token(TokenSymbols.RWA005, 18) +const RWA006 = new Token(TokenSymbols.RWA006, 18) +const SDAI = new Token(TokenSymbols.SDAI, 18) +const TBTC = new Token(TokenSymbols.TBTC, 18) +const TUSD = new Token(TokenSymbols.TUSD, 18) +const UNIV2DAIETH = new Token(TokenSymbols.UNIV2DAIETH, 18) +const UNIV2DAIUSDC = new Token(TokenSymbols.UNIV2DAIUSDC, 18) +const UNIV2DAIUSDT = new Token(TokenSymbols.UNIV2DAIUSDT, 18) +const UNIV2ETHUSDT = new Token(TokenSymbols.UNIV2ETHUSDT, 18) +const UNIV2LINKETH = new Token(TokenSymbols.UNIV2LINKETH, 18) +const UNIV2UNIETH = new Token(TokenSymbols.UNIV2UNIETH, 18) +const UNIV2USDCETH = new Token(TokenSymbols.UNIV2USDCETH, 18) +const UNIV2WBTCETH = new Token(TokenSymbols.UNIV2WBTCETH, 18) +const USDT = new Token(TokenSymbols.USDT, 6) +const WLD = new Token(TokenSymbols.WLD, 8) +const YIELDBTC = new Token(TokenSymbols.YIELDBTC, 8) +const YIELDETH = new Token(TokenSymbols.YIELDETH, 18) +const YFI = new Token(TokenSymbols.YFI, 18) +const ZRX = new Token(TokenSymbols.ZRX, 18) + +type AllTokenSymbols = { + [key in TokenSymbols]: Token; +}; + +export const Tokens: AllTokenSymbols = { + USDC, + WETH, + WBTC, + DAI, + ETH, + STETH, + WSTETH, + CBETH, + RETH, + AAVE, + LINK, + UNI, + SUSHI, + CRV, + SNX, + ADAI, + BAL, + BAT, + COMP, + CRVV1ETHSTETH, + FRAX, + GHO, + GNO, + GUNIV3DAIUSDC1, + GUNIV3DAIUSDC2, + GUSD, + KNC, + LDO, + LRC, + LUSD, + MANA, + MATIC, + PAX, + PAXUSD, + RENBTC, + RWA001, + RWA002, + RWA003, + RWA004, + RWA005, + RWA006, + SDAI, + TBTC, + TUSD, + UNIV2DAIETH, + UNIV2DAIUSDC, + UNIV2DAIUSDT, + UNIV2ETHUSDT, + UNIV2LINKETH, + UNIV2UNIETH, + UNIV2USDCETH, + UNIV2WBTCETH, + USDT, + WLD, + YIELDBTC, + YIELDETH, + YFI, + ZRX +} \ No newline at end of file diff --git a/configs/domain/getTokens.ts b/configs/domain/getTokens.ts index b944ba5..146bd34 100644 --- a/configs/domain/getTokens.ts +++ b/configs/domain/getTokens.ts @@ -1,39 +1,22 @@ import { ConfigHelperType } from "⌨️"; +import {Network} from "../../common"; +import { TokenSymbols} from "../../common"; + +const commonTokens = { + +} + +interface Token { + symbol: TokenSymbols + precision: number +} export const getTokens = ({ isStaging, - }: Pick) => ({ - AaveV3ArbitrumBorrow: true, - AaveV3ArbitrumEarn: false, - AaveV3EarncbETHeth: false, - AaveV3EarnrETHeth: false, - AaveV3History: false, - AaveV3OptimismBorrow: true, - AaveV3OptimismEarn: false, - AaveV3Protection: true, - AaveV3ProtectionWrite: true, - AjnaPoolFinder: true, - AjnaReusableDPM: false, - AjnaSafetySwitch: true, - AjnaSuppressValidation: false, - AnotherTestFeature: true, // used in unit tests - ConstantMultipleReadOnly: false, - DaiSavingsRate: true, - DisableSidebarScroll: false, - FollowAAVEVaults: false, - NewNavigation: true, - ProxyCreationDisabled: false, - ProxyReveal: false, - ReadOnlyAutoTakeProfit: false, - ReadOnlyBasicBS: false, - Referrals: true, - Sillyness: false, - StopLossOpenFlow: false, - StopLossRead: true, - StopLossWrite: true, - TestFeature: false, // used in unit tests - UseNetworkSwitcherForks: false, - UseNetworkSwitcherTestnets: false, - SparkProtocolStopLoss: isStaging, - UseRpcGateway: false, + }: Pick): Record => ({ + [Network.MAINNET]: { + symbol: TokenSymbols.USDC, + precision: 6, + } + }); From 8e3e166cedec3113db295871d586567fc8a6f337 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 12:30:20 +0100 Subject: [PATCH 04/17] feat: implement getTokens getter --- common/denomination-symbols.ts | 22 +++++++++++++++ common/index.ts | 3 +- common/token-symbols.ts | 2 +- common/tokens.ts | 9 +++++- configs/domain/getTokens.ts | 25 ++++++++--------- configs/domain/getTokensByNetwork.ts | 42 ++++++++++++++++++++++++++++ configs/domain/index.ts | 4 ++- 7 files changed, 89 insertions(+), 18 deletions(-) create mode 100644 common/denomination-symbols.ts create mode 100644 configs/domain/getTokensByNetwork.ts diff --git a/common/denomination-symbols.ts b/common/denomination-symbols.ts new file mode 100644 index 0000000..8c23efa --- /dev/null +++ b/common/denomination-symbols.ts @@ -0,0 +1,22 @@ +export enum DenominationSymbols { + USD = 'USD', + ETH = 'ETH', + BTC = 'BTC', + GBP = 'GBP', + EUR = 'EUR', + JPY = 'JPY', + KRW = 'KRW', + CNY = 'CNY', + AUD = 'AUD', + CAD = 'CAD', + CHF = 'CHF', + ARS = 'ARS', + PHP = 'PHP', + NZD = 'NZD', + SGD = 'SGD', + NGN = 'NGN', + ZAR = 'ZAR', + RUB = 'RUB', + INR = 'INR', + BRL = 'BRL' +} diff --git a/common/index.ts b/common/index.ts index a97d1de..88a43e6 100644 --- a/common/index.ts +++ b/common/index.ts @@ -1,3 +1,4 @@ export * from './networks'; export * from './token-symbols' -export * from './tokens'; +export * from './denomination-symbols' +export * from './tokens'; \ No newline at end of file diff --git a/common/token-symbols.ts b/common/token-symbols.ts index befcd8b..d4b7802 100644 --- a/common/token-symbols.ts +++ b/common/token-symbols.ts @@ -59,4 +59,4 @@ export enum TokenSymbols { YIELDETH = 'YIELDETH', YFI = 'YFI', ZRX = 'ZRX', -} +} \ No newline at end of file diff --git a/common/tokens.ts b/common/tokens.ts index 4234b20..fbafd45 100644 --- a/common/tokens.ts +++ b/common/tokens.ts @@ -13,6 +13,13 @@ class Token implements IToken { this.symbol = symbol this.precision = precision } + + toObject(): { symbol: TokenSymbols; precision: number } { + return { + symbol: this.symbol, + precision: this.precision + }; + } } const ETH = new Token(TokenSymbols.ETH, 18) @@ -78,7 +85,7 @@ type AllTokenSymbols = { [key in TokenSymbols]: Token; }; -export const Tokens: AllTokenSymbols = { +export const tokens: AllTokenSymbols = { USDC, WETH, WBTC, diff --git a/configs/domain/getTokens.ts b/configs/domain/getTokens.ts index 146bd34..202d9fb 100644 --- a/configs/domain/getTokens.ts +++ b/configs/domain/getTokens.ts @@ -1,22 +1,19 @@ -import { ConfigHelperType } from "⌨️"; -import {Network} from "../../common"; -import { TokenSymbols} from "../../common"; - -const commonTokens = { - -} +import {TokenSymbols} from "../../common"; +import {tokens} from "../../common"; interface Token { symbol: TokenSymbols precision: number } -export const getTokens = ({ - isStaging, - }: Pick): Record => ({ - [Network.MAINNET]: { - symbol: TokenSymbols.USDC, - precision: 6, +export const getTokens = (): Record => { + const result: Record = {} as any; + + for (const symbol of Object.keys(tokens) as TokenSymbols[]) { + if (Object.prototype.hasOwnProperty.call(tokens, symbol) && tokens[symbol].toObject) { + result[symbol] = { ...tokens[symbol].toObject() }; + } } -}); + return result; +}; \ No newline at end of file diff --git a/configs/domain/getTokensByNetwork.ts b/configs/domain/getTokensByNetwork.ts new file mode 100644 index 0000000..d3affdb --- /dev/null +++ b/configs/domain/getTokensByNetwork.ts @@ -0,0 +1,42 @@ +import {TokenSymbols} from "../../common"; +import {tokens} from "../../common"; + +interface Token { + symbol: TokenSymbols + precision: number +} + +export const getTokens = (): Record => { + const result: Record = {} as any; + + for (const symbol of Object.keys(tokens) as TokenSymbols[]) { + if (Object.prototype.hasOwnProperty.call(tokens, symbol) && tokens[symbol].toObject) { + result[symbol] = { ...tokens[symbol].toObject() }; + } + } + + return result; +}; + + +// const configObject = { +// tokens: { +// 'USDC': { +// symbol: 'USDC', +// precision: 6 +// }, +// 'DAI': { +// symbol: 'DAI', +// precision: 18 +// }, +// 'WETH': { +// symbol: 'WETH', +// precision: 18 +// } +// }, +// tokensByNetwork: { +// mainnet: ['USDC', 'DAI'], +// optimism: ['USDC'], +// arbitrum: ['WETH'] +// } +// } \ No newline at end of file diff --git a/configs/domain/index.ts b/configs/domain/index.ts index 44581f9..a1853c3 100644 --- a/configs/domain/index.ts +++ b/configs/domain/index.ts @@ -1,4 +1,5 @@ import {ConfigHelperType} from "⌨️"; +import {getTokens} from "./getTokens"; // import { getFeatures } from "./getFeatures"; // import { getNavigation } from "./getNavigation"; // import { getParameters } from "./getParameters"; @@ -17,7 +18,8 @@ export default function ({ * Possible extensions could include Products / Product categories / Strategies etc */ return { - tokens: null, + tokens: getTokens(), + tokensByNetwork: getTokensByNetwork(), lendingProtocols: null, networks: null, }; From c4023a623a01333bc03df5ef524e7137f1cc36c3 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 12:47:10 +0100 Subject: [PATCH 05/17] feat: implement getTokensByNetwork getter --- common/networks.ts | 10 ++--- configs/domain/getTokensByNetwork.ts | 58 ++++++++++------------------ 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/common/networks.ts b/common/networks.ts index a52b2b7..06eda68 100644 --- a/common/networks.ts +++ b/common/networks.ts @@ -1,10 +1,10 @@ -export enum Network { +export enum MainNetworks { MAINNET = 'mainnet', - GOERLI = 'goerli', - HARDHAT = 'hardhat', OPTIMISM = 'optimism', ARBITRUM = 'arbitrum', BASE = 'base', - LOCAL = 'local', - TENDERLY = 'tenderly', +} + +export enum TestNetworks { + GOERLI = 'goerli', } diff --git a/configs/domain/getTokensByNetwork.ts b/configs/domain/getTokensByNetwork.ts index d3affdb..31bfed8 100644 --- a/configs/domain/getTokensByNetwork.ts +++ b/configs/domain/getTokensByNetwork.ts @@ -1,42 +1,24 @@ -import {TokenSymbols} from "../../common"; -import {tokens} from "../../common"; +import {MainNetworks, TestNetworks, TokenSymbols} from "../../common"; -interface Token { - symbol: TokenSymbols - precision: number -} - -export const getTokens = (): Record => { - const result: Record = {} as any; +type NetworkTokens = { + main: { + [network in MainNetworks]: TokenSymbols[]; + }; + test: { + [network in TestNetworks]: TokenSymbols[]; + }; +}; - for (const symbol of Object.keys(tokens) as TokenSymbols[]) { - if (Object.prototype.hasOwnProperty.call(tokens, symbol) && tokens[symbol].toObject) { - result[symbol] = { ...tokens[symbol].toObject() }; +export const getTokensByNetwork = (): NetworkTokens => { + return { + main: { + [MainNetworks.MAINNET]: [TokenSymbols.USDC], + [MainNetworks.OPTIMISM]: [TokenSymbols.USDC], + [MainNetworks.ARBITRUM]: [TokenSymbols.USDC], + [MainNetworks.BASE]: [TokenSymbols.USDC], + }, + test: { + [TestNetworks.GOERLI]: [TokenSymbols.USDC], } } - - return result; -}; - - -// const configObject = { -// tokens: { -// 'USDC': { -// symbol: 'USDC', -// precision: 6 -// }, -// 'DAI': { -// symbol: 'DAI', -// precision: 18 -// }, -// 'WETH': { -// symbol: 'WETH', -// precision: 18 -// } -// }, -// tokensByNetwork: { -// mainnet: ['USDC', 'DAI'], -// optimism: ['USDC'], -// arbitrum: ['WETH'] -// } -// } \ No newline at end of file +}; \ No newline at end of file From 5e8da6052d131ca604b8421d5021da3bd7c32b86 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 15:06:40 +0100 Subject: [PATCH 06/17] feat: add getNetworks and getLendingProtocols getters --- common/networks.ts | 10 ------- configs/domain/README.md | 0 configs/domain/getLendingProtocols.ts | 11 +++++++ configs/domain/getNetworks.ts | 6 ++++ configs/domain/getTokens.ts | 5 ++-- configs/domain/getTokensByNetwork.ts | 35 ++++++++++++---------- configs/domain/index.ts | 19 ++++-------- helpers/enum-to-object.ts | 12 ++++++++ helpers/index.ts | 1 + {common => shared}/denomination-symbols.ts | 0 {common => shared}/index.ts | 3 +- shared/lending-protocols.ts | 15 ++++++++++ shared/networks.ts | 15 ++++++++++ {common => shared}/token-symbols.ts | 0 {common => shared}/tokens.ts | 18 ++++++----- tsconfig.json | 3 +- 16 files changed, 102 insertions(+), 51 deletions(-) delete mode 100644 common/networks.ts create mode 100644 configs/domain/README.md create mode 100644 configs/domain/getLendingProtocols.ts create mode 100644 configs/domain/getNetworks.ts create mode 100644 helpers/enum-to-object.ts rename {common => shared}/denomination-symbols.ts (100%) rename {common => shared}/index.ts (61%) create mode 100644 shared/lending-protocols.ts create mode 100644 shared/networks.ts rename {common => shared}/token-symbols.ts (100%) rename {common => shared}/tokens.ts (94%) diff --git a/common/networks.ts b/common/networks.ts deleted file mode 100644 index 06eda68..0000000 --- a/common/networks.ts +++ /dev/null @@ -1,10 +0,0 @@ -export enum MainNetworks { - MAINNET = 'mainnet', - OPTIMISM = 'optimism', - ARBITRUM = 'arbitrum', - BASE = 'base', -} - -export enum TestNetworks { - GOERLI = 'goerli', -} diff --git a/configs/domain/README.md b/configs/domain/README.md new file mode 100644 index 0000000..e69de29 diff --git a/configs/domain/getLendingProtocols.ts b/configs/domain/getLendingProtocols.ts new file mode 100644 index 0000000..ef320db --- /dev/null +++ b/configs/domain/getLendingProtocols.ts @@ -0,0 +1,11 @@ +import { LendingProtocol, LendingProtocolLabel} from "🤝"; + +export const getLendingProtocols = (): Record => { + return { + [LendingProtocol.AaveV2]: LendingProtocolLabel.aavev2, + [LendingProtocol.AaveV3]: LendingProtocolLabel.aavev3, + [LendingProtocol.Ajna]: LendingProtocolLabel.ajna, + [LendingProtocol.Maker]: LendingProtocolLabel.maker, + [LendingProtocol.SparkV3]: LendingProtocolLabel.sparkv3, + } +}; \ No newline at end of file diff --git a/configs/domain/getNetworks.ts b/configs/domain/getNetworks.ts new file mode 100644 index 0000000..ea04526 --- /dev/null +++ b/configs/domain/getNetworks.ts @@ -0,0 +1,6 @@ +import {EnumToObject, enumToObject} from "🛠️"; +import {Networks} from "🤝"; + +export const getNetworks = (): EnumToObject => { + return enumToObject(Networks) +}; \ No newline at end of file diff --git a/configs/domain/getTokens.ts b/configs/domain/getTokens.ts index 202d9fb..2deae5c 100644 --- a/configs/domain/getTokens.ts +++ b/configs/domain/getTokens.ts @@ -1,5 +1,4 @@ -import {TokenSymbols} from "../../common"; -import {tokens} from "../../common"; +import {TokenSymbols, tokens} from "🤝"; interface Token { symbol: TokenSymbols @@ -7,7 +6,7 @@ interface Token { } export const getTokens = (): Record => { - const result: Record = {} as any; + const result: Record = {} as unknown as Record; for (const symbol of Object.keys(tokens) as TokenSymbols[]) { if (Object.prototype.hasOwnProperty.call(tokens, symbol) && tokens[symbol].toObject) { diff --git a/configs/domain/getTokensByNetwork.ts b/configs/domain/getTokensByNetwork.ts index 31bfed8..28b17c2 100644 --- a/configs/domain/getTokensByNetwork.ts +++ b/configs/domain/getTokensByNetwork.ts @@ -1,24 +1,27 @@ -import {MainNetworks, TestNetworks, TokenSymbols} from "../../common"; +import {Networks, Token, TokenSymbols, tokens} from "🤝"; + +type TokenSubset = { + [key in TokenSymbols]?: Token; +}; type NetworkTokens = { - main: { - [network in MainNetworks]: TokenSymbols[]; - }; - test: { - [network in TestNetworks]: TokenSymbols[]; - }; + [network in Networks]: TokenSubset[]; }; +/** + * Returns tokens for each network + * Could be enhanced to return tokens with address + */ export const getTokensByNetwork = (): NetworkTokens => { return { - main: { - [MainNetworks.MAINNET]: [TokenSymbols.USDC], - [MainNetworks.OPTIMISM]: [TokenSymbols.USDC], - [MainNetworks.ARBITRUM]: [TokenSymbols.USDC], - [MainNetworks.BASE]: [TokenSymbols.USDC], - }, - test: { - [TestNetworks.GOERLI]: [TokenSymbols.USDC], - } + [Networks.MAINNET]: [{[TokenSymbols.USDC]: tokens.USDC}, {[TokenSymbols.DAI]: tokens.DAI}], + [Networks.OPTIMISM]: [{[TokenSymbols.USDC]: tokens.USDC}], + [Networks.ARBITRUM]: [{[TokenSymbols.USDC]: tokens.USDC}], + [Networks.BASE]: [{[TokenSymbols.USDC]: tokens.USDC}], + [Networks.POLYGON]: [{[TokenSymbols.USDC]: tokens.USDC}], + [Networks.GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC}], + [Networks.OPTIMISM_GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC}], + [Networks.ARBITRUM_GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC}], + [Networks.POLYGON_MUMBAI]: [{[TokenSymbols.USDC]: tokens.USDC}], } }; \ No newline at end of file diff --git a/configs/domain/index.ts b/configs/domain/index.ts index a1853c3..2f14f10 100644 --- a/configs/domain/index.ts +++ b/configs/domain/index.ts @@ -1,16 +1,9 @@ -import {ConfigHelperType} from "⌨️"; +import {getLendingProtocols} from "./getLendingProtocols"; +import {getNetworks} from "./getNetworks"; import {getTokens} from "./getTokens"; -// import { getFeatures } from "./getFeatures"; -// import { getNavigation } from "./getNavigation"; -// import { getParameters } from "./getParameters"; -// import { getRpcConfig } from "./getRpcConfig"; +import {getTokensByNetwork} from "./getTokensByNetwork"; - -export default function ({ - isDevelopment: _isDevelopment, - notProduction, - isStaging, - }: ConfigHelperType) { +export default function () { /** * Goal is to capture domain specific configurations that is common * across all Summer.fi systems and apps. @@ -20,7 +13,7 @@ export default function ({ return { tokens: getTokens(), tokensByNetwork: getTokensByNetwork(), - lendingProtocols: null, - networks: null, + lendingProtocols: getLendingProtocols(), + networks: getNetworks(), }; } diff --git a/helpers/enum-to-object.ts b/helpers/enum-to-object.ts new file mode 100644 index 0000000..7e214f6 --- /dev/null +++ b/helpers/enum-to-object.ts @@ -0,0 +1,12 @@ +export type EnumToObject> = { + [K in keyof E]: E[K]; +}; + +export function enumToObject>(e: E): { [K in keyof E]: E[K] } { + return Object.keys(e) + .filter(key => isNaN(Number(key))) + .reduce((obj, key) => { + obj[key as keyof E] = e[key as keyof E]; + return obj; + }, {} as { [K in keyof E]: E[K] }); +} \ No newline at end of file diff --git a/helpers/index.ts b/helpers/index.ts index 3b74e11..8a220c1 100644 --- a/helpers/index.ts +++ b/helpers/index.ts @@ -4,3 +4,4 @@ export { getConfigMainModules } from "./get-config-main-modules"; export { getEnvironments } from "./get-environments"; export { parseConfig } from "./parse-config"; export { createConfigFiles } from "./create-config-files"; +export * from './enum-to-object' \ No newline at end of file diff --git a/common/denomination-symbols.ts b/shared/denomination-symbols.ts similarity index 100% rename from common/denomination-symbols.ts rename to shared/denomination-symbols.ts diff --git a/common/index.ts b/shared/index.ts similarity index 61% rename from common/index.ts rename to shared/index.ts index 88a43e6..6e86f57 100644 --- a/common/index.ts +++ b/shared/index.ts @@ -1,4 +1,5 @@ export * from './networks'; export * from './token-symbols' export * from './denomination-symbols' -export * from './tokens'; \ No newline at end of file +export * from './tokens'; +export * from './lending-protocols' \ No newline at end of file diff --git a/shared/lending-protocols.ts b/shared/lending-protocols.ts new file mode 100644 index 0000000..04decc4 --- /dev/null +++ b/shared/lending-protocols.ts @@ -0,0 +1,15 @@ +export enum LendingProtocol { + AaveV2 = 'aavev2', + AaveV3 = 'aavev3', + Ajna = 'ajna', + Maker = 'maker', + SparkV3 = 'sparkv3', +} + +export enum LendingProtocolLabel { + aavev2 = 'Aave V2', + aavev3 = 'Aave V3', + ajna = 'Ajna', + maker = 'Maker', + sparkv3 = 'Spark', +} \ No newline at end of file diff --git a/shared/networks.ts b/shared/networks.ts new file mode 100644 index 0000000..8c1efb8 --- /dev/null +++ b/shared/networks.ts @@ -0,0 +1,15 @@ +export enum Networks { + // Mainnets + MAINNET = 'mainnet', + OPTIMISM = 'optimism', + ARBITRUM = 'arbitrum', + BASE = 'base', + POLYGON = 'polygon', + + // Testnets + GOERLI = 'goerli', + OPTIMISM_GOERLI = 'optimism_goerli', + ARBITRUM_GOERLI = 'arbitrum_goerli', + POLYGON_MUMBAI = 'polygon_mumbai', + +} \ No newline at end of file diff --git a/common/token-symbols.ts b/shared/token-symbols.ts similarity index 100% rename from common/token-symbols.ts rename to shared/token-symbols.ts diff --git a/common/tokens.ts b/shared/tokens.ts similarity index 94% rename from common/tokens.ts rename to shared/tokens.ts index fbafd45..d093e3d 100644 --- a/common/tokens.ts +++ b/shared/tokens.ts @@ -5,7 +5,7 @@ interface IToken { precision: number } -class Token implements IToken { +export class Token implements IToken { symbol: TokenSymbols precision: number @@ -66,6 +66,7 @@ const RWA006 = new Token(TokenSymbols.RWA006, 18) const SDAI = new Token(TokenSymbols.SDAI, 18) const TBTC = new Token(TokenSymbols.TBTC, 18) const TUSD = new Token(TokenSymbols.TUSD, 18) +const UNIV2AAVEETH = new Token(TokenSymbols.UNIV2AAVEETH, 18) const UNIV2DAIETH = new Token(TokenSymbols.UNIV2DAIETH, 18) const UNIV2DAIUSDC = new Token(TokenSymbols.UNIV2DAIUSDC, 18) const UNIV2DAIUSDT = new Token(TokenSymbols.UNIV2DAIUSDT, 18) @@ -73,6 +74,7 @@ const UNIV2ETHUSDT = new Token(TokenSymbols.UNIV2ETHUSDT, 18) const UNIV2LINKETH = new Token(TokenSymbols.UNIV2LINKETH, 18) const UNIV2UNIETH = new Token(TokenSymbols.UNIV2UNIETH, 18) const UNIV2USDCETH = new Token(TokenSymbols.UNIV2USDCETH, 18) +const UNIV2WBTCDAI = new Token(TokenSymbols.UNIV2WBTCDAI, 18) const UNIV2WBTCETH = new Token(TokenSymbols.UNIV2WBTCETH, 18) const USDT = new Token(TokenSymbols.USDT, 6) const WLD = new Token(TokenSymbols.WLD, 8) @@ -81,18 +83,18 @@ const YIELDETH = new Token(TokenSymbols.YIELDETH, 18) const YFI = new Token(TokenSymbols.YFI, 18) const ZRX = new Token(TokenSymbols.ZRX, 18) -type AllTokenSymbols = { +export type Tokens = { [key in TokenSymbols]: Token; }; -export const tokens: AllTokenSymbols = { - USDC, - WETH, - WBTC, - DAI, +export const tokens: Tokens = { ETH, + WETH, STETH, WSTETH, + WBTC, + USDC, + DAI, CBETH, RETH, AAVE, @@ -130,6 +132,7 @@ export const tokens: AllTokenSymbols = { SDAI, TBTC, TUSD, + UNIV2AAVEETH, UNIV2DAIETH, UNIV2DAIUSDC, UNIV2DAIUSDT, @@ -137,6 +140,7 @@ export const tokens: AllTokenSymbols = { UNIV2LINKETH, UNIV2UNIETH, UNIV2USDCETH, + UNIV2WBTCDAI, UNIV2WBTCETH, USDT, WLD, diff --git a/tsconfig.json b/tsconfig.json index 35883c8..f96ab62 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,8 @@ "types": ["bun-types"], "paths": { "🛠️": ["./helpers/index.ts"], - "⌨️": ["./types/index.ts"] + "⌨️": ["./types/index.ts"], + "🤝": ["./shared/index.ts"], } }, "include": ["**/*.ts"] From ae0f1111dffbcb34137c04ec68c12a3d820da788 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 15:18:00 +0100 Subject: [PATCH 07/17] feat: add denomination symbols to domain config --- configs/domain/getDenominationSymbols.ts | 6 ++++++ configs/domain/getTokens.ts | 10 +++------- configs/domain/getTokensByNetwork.ts | 22 +++++++++++----------- configs/domain/index.ts | 2 ++ shared/networks.ts | 1 - shared/tokens.ts | 18 ++++++++++++++---- 6 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 configs/domain/getDenominationSymbols.ts diff --git a/configs/domain/getDenominationSymbols.ts b/configs/domain/getDenominationSymbols.ts new file mode 100644 index 0000000..0d37679 --- /dev/null +++ b/configs/domain/getDenominationSymbols.ts @@ -0,0 +1,6 @@ +import {DenominationSymbols} from "🤝"; +import {EnumToObject, enumToObject} from "🛠️"; + +export const getDenominationSymbols = (): EnumToObject => { + return enumToObject(DenominationSymbols) +}; \ No newline at end of file diff --git a/configs/domain/getTokens.ts b/configs/domain/getTokens.ts index 2deae5c..637306c 100644 --- a/configs/domain/getTokens.ts +++ b/configs/domain/getTokens.ts @@ -1,12 +1,8 @@ -import {TokenSymbols, tokens} from "🤝"; +import {IToken, TokenSymbols, tokens} from "🤝"; -interface Token { - symbol: TokenSymbols - precision: number -} -export const getTokens = (): Record => { - const result: Record = {} as unknown as Record; +export const getTokens = (): Record => { + const result: Record = {} as unknown as Record; for (const symbol of Object.keys(tokens) as TokenSymbols[]) { if (Object.prototype.hasOwnProperty.call(tokens, symbol) && tokens[symbol].toObject) { diff --git a/configs/domain/getTokensByNetwork.ts b/configs/domain/getTokensByNetwork.ts index 28b17c2..571d34b 100644 --- a/configs/domain/getTokensByNetwork.ts +++ b/configs/domain/getTokensByNetwork.ts @@ -1,7 +1,7 @@ -import {Networks, Token, TokenSymbols, tokens} from "🤝"; +import {IToken, Networks, TokenSymbols, tokens} from "🤝"; type TokenSubset = { - [key in TokenSymbols]?: Token; + [key in TokenSymbols]?: IToken; }; type NetworkTokens = { @@ -14,14 +14,14 @@ type NetworkTokens = { */ export const getTokensByNetwork = (): NetworkTokens => { return { - [Networks.MAINNET]: [{[TokenSymbols.USDC]: tokens.USDC}, {[TokenSymbols.DAI]: tokens.DAI}], - [Networks.OPTIMISM]: [{[TokenSymbols.USDC]: tokens.USDC}], - [Networks.ARBITRUM]: [{[TokenSymbols.USDC]: tokens.USDC}], - [Networks.BASE]: [{[TokenSymbols.USDC]: tokens.USDC}], - [Networks.POLYGON]: [{[TokenSymbols.USDC]: tokens.USDC}], - [Networks.GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC}], - [Networks.OPTIMISM_GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC}], - [Networks.ARBITRUM_GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC}], - [Networks.POLYGON_MUMBAI]: [{[TokenSymbols.USDC]: tokens.USDC}], + [Networks.MAINNET]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}, {[TokenSymbols.DAI]: tokens.DAI.setAddress('').toObject()}], + [Networks.OPTIMISM]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], + [Networks.ARBITRUM]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], + [Networks.BASE]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], + [Networks.POLYGON]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], + [Networks.GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], + [Networks.OPTIMISM_GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], + [Networks.ARBITRUM_GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], + [Networks.POLYGON_MUMBAI]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], } }; \ No newline at end of file diff --git a/configs/domain/index.ts b/configs/domain/index.ts index 2f14f10..831a4a3 100644 --- a/configs/domain/index.ts +++ b/configs/domain/index.ts @@ -1,3 +1,4 @@ +import {getDenominationSymbols} from "./getDenominationSymbols"; import {getLendingProtocols} from "./getLendingProtocols"; import {getNetworks} from "./getNetworks"; import {getTokens} from "./getTokens"; @@ -15,5 +16,6 @@ export default function () { tokensByNetwork: getTokensByNetwork(), lendingProtocols: getLendingProtocols(), networks: getNetworks(), + denominationSymbols: getDenominationSymbols() }; } diff --git a/shared/networks.ts b/shared/networks.ts index 8c1efb8..a9dbb59 100644 --- a/shared/networks.ts +++ b/shared/networks.ts @@ -11,5 +11,4 @@ export enum Networks { OPTIMISM_GOERLI = 'optimism_goerli', ARBITRUM_GOERLI = 'arbitrum_goerli', POLYGON_MUMBAI = 'polygon_mumbai', - } \ No newline at end of file diff --git a/shared/tokens.ts b/shared/tokens.ts index d093e3d..2d939b9 100644 --- a/shared/tokens.ts +++ b/shared/tokens.ts @@ -1,23 +1,33 @@ import {TokenSymbols} from "./token-symbols"; -interface IToken { +export interface IToken { symbol: TokenSymbols precision: number + address: string } export class Token implements IToken { symbol: TokenSymbols precision: number + address: string - constructor(symbol: TokenSymbols, precision: number) { + constructor(symbol: TokenSymbols, precision: number, address = '') { this.symbol = symbol this.precision = precision + this.address = address } - toObject(): { symbol: TokenSymbols; precision: number } { + setAddress(address: string) { + this.address = address + + return this + } + + toObject(): { symbol: TokenSymbols; precision: number, address: string } { return { symbol: this.symbol, - precision: this.precision + precision: this.precision, + address: this.address }; } } From 638eaab8364e3b7c04c26470191060313b4cccda Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 15:27:20 +0100 Subject: [PATCH 08/17] feat: update Token class to chain the setAddress method --- configs/domain/getTokens.ts | 4 ++-- shared/tokens.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configs/domain/getTokens.ts b/configs/domain/getTokens.ts index 637306c..d4119d7 100644 --- a/configs/domain/getTokens.ts +++ b/configs/domain/getTokens.ts @@ -1,8 +1,8 @@ import {IToken, TokenSymbols, tokens} from "🤝"; -export const getTokens = (): Record => { - const result: Record = {} as unknown as Record; +export const getTokens = (): Record> => { + const result: Record> = {} as unknown as Record>; for (const symbol of Object.keys(tokens) as TokenSymbols[]) { if (Object.prototype.hasOwnProperty.call(tokens, symbol) && tokens[symbol].toObject) { diff --git a/shared/tokens.ts b/shared/tokens.ts index 2d939b9..b6fe397 100644 --- a/shared/tokens.ts +++ b/shared/tokens.ts @@ -3,7 +3,7 @@ import {TokenSymbols} from "./token-symbols"; export interface IToken { symbol: TokenSymbols precision: number - address: string + address?: string } export class Token implements IToken { @@ -11,7 +11,7 @@ export class Token implements IToken { precision: number address: string - constructor(symbol: TokenSymbols, precision: number, address = '') { + constructor(symbol: TokenSymbols, precision: number, address?: string) { this.symbol = symbol this.precision = precision this.address = address @@ -23,11 +23,11 @@ export class Token implements IToken { return this } - toObject(): { symbol: TokenSymbols; precision: number, address: string } { + toObject(): { symbol: TokenSymbols; precision: number, address?: string } { return { symbol: this.symbol, precision: this.precision, - address: this.address + address: this.address || undefined }; } } From da01c493132a266fb502614440f0d323bbaeca41 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 15:57:15 +0100 Subject: [PATCH 09/17] feat: add addresses to getTokensByNetwork --- bun.lockb | Bin 82360 -> 82743 bytes ...Symbols.ts => get-denomination-symbols.ts} | 0 ...gProtocols.ts => get-lending-protocols.ts} | 0 .../{getNetworks.ts => get-networks.ts} | 0 configs/domain/get-tokens-by-network.ts | 273 ++++++++++++++++++ .../domain/{getTokens.ts => get-tokens.ts} | 0 configs/domain/getTokensByNetwork.ts | 27 -- configs/domain/index.ts | 10 +- package.json | 1 + 9 files changed, 279 insertions(+), 32 deletions(-) rename configs/domain/{getDenominationSymbols.ts => get-denomination-symbols.ts} (100%) rename configs/domain/{getLendingProtocols.ts => get-lending-protocols.ts} (100%) rename configs/domain/{getNetworks.ts => get-networks.ts} (100%) create mode 100644 configs/domain/get-tokens-by-network.ts rename configs/domain/{getTokens.ts => get-tokens.ts} (100%) delete mode 100644 configs/domain/getTokensByNetwork.ts diff --git a/bun.lockb b/bun.lockb index d7def70fc830becc30092042b2b336b31ff2d5eb..313146d137e1cc1b1ee596cb9f4ce69432ad27a8 100755 GIT binary patch delta 12860 zcmeHN3v^Y*)jo5%H^~W*cS25XLLNdi#5^w{fsmYt1OyBa6ct1;kQlB>NJxSOt>kK@ z*s8U#p`Zc@m5Koo!$T?$1$={2!BXXAMFKQD4UYmM&~MK<2VzU@>RPt{>iV6vzO!fV z*)y|e&z_lc&z;}@%(3R@j$bDytaj}_xpQm8ANqw%dCvai=w(aqU-QoL^_4Gw-qk&Q z@X6lO7xxhgr#&<7j;=fTxy+l7AVu*kN8T5-+Femy^njw2mRFAD;?=0t9`XwJ1b0xC1wH`$V$hDD4R%An2Gq9>ffi2T7-Y3G1%|Of6|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jrWqnsET(tSS{y2%6e(w}LDChe^hjopxq+N^rWpnd$ZNh2n1*Ivy_r23$T@#!) zxBL5_Z5S4X9@CPY>;QIZhn7)^#(8F48_e4l|3RO5+7;-fLJuQ1rBPQjA#-}>N~&W4 z9z}Qnc(sqK)I&4hSPo5gDVE%qjzTkzZd~b)KaKDDp})hrLO5&e+|}>w-+sg+6UebH9eo_1eNX;@9JXaL1r(;U_A)C9S?zDxRbGT1_mZj9SfMT_5cA-k34F+I&}r z9@32ouB6i1!Zhpp;i{tLpYIHNw;AfqSy>kpj~^QJQPKIB2V{+OO%gS}?i2x}U)LNB zoL{NQ=s{8B$q3tKU+<3?IRIVjvSO2EyLWfXb;d2u%~ z>Sl^qO#N;;v3DzO7B&zV(uW93J_|JLZAYCGm&~_k;8*LJp5J zdZ|uxSa&IXhNaxI%Xiras5hSnuhSm1x9(D|Jh<^(e0j%c)Wd=7Z(|BF7JOx_*PB!G z29Gv*Kv=FxqK$A(-|DMESm#jwvst3Q$a;2`=y2On@}%r)UA+AGbn1#JZyY`cD_pR` zjsKUjj7RayQ{PD{+H2={b7AY@o~boZ{WTDk)gy%Hm1Ql%Pi$Pgc=Ccw$eR23L;DVX zB1jK~w7|MiCZGHGTV;iN zpLr#_y4EIQMRv8;NaRN1Xys0nxEzDx9WFgPt_yjOMO9Zf65;FLZ6sdG#;v7Jv^zBJ JHbw`j{{ytfP#^#R diff --git a/configs/domain/getDenominationSymbols.ts b/configs/domain/get-denomination-symbols.ts similarity index 100% rename from configs/domain/getDenominationSymbols.ts rename to configs/domain/get-denomination-symbols.ts diff --git a/configs/domain/getLendingProtocols.ts b/configs/domain/get-lending-protocols.ts similarity index 100% rename from configs/domain/getLendingProtocols.ts rename to configs/domain/get-lending-protocols.ts diff --git a/configs/domain/getNetworks.ts b/configs/domain/get-networks.ts similarity index 100% rename from configs/domain/getNetworks.ts rename to configs/domain/get-networks.ts diff --git a/configs/domain/get-tokens-by-network.ts b/configs/domain/get-tokens-by-network.ts new file mode 100644 index 0000000..bacaf15 --- /dev/null +++ b/configs/domain/get-tokens-by-network.ts @@ -0,0 +1,273 @@ +import {ADDRESSES, SystemKeys} from '@oasisdex/addresses' +import {IToken, Networks, TokenSymbols, tokens} from "🤝"; + +type TokenSubset = { + [key in TokenSymbols]?: IToken; +}; + +type NetworkTokens = { + [network in Networks]: TokenSubset[]; +}; + +/** + * Returns tokens for each network + * Can be enhanced to return address enriched tokens for each network + */ +export const getTokensByNetwork = (): NetworkTokens => { + const mainnetCommon = ADDRESSES[Networks.MAINNET][SystemKeys.COMMON] + const optimismCommon = ADDRESSES[Networks.OPTIMISM][SystemKeys.COMMON] + const arbitrumCommon = ADDRESSES[Networks.ARBITRUM][SystemKeys.COMMON] + // const baseCommon = ADDRESSES[Networks.BASE][SystemKeys.COMMON] + // const polygonCommon = ADDRESSES[Networks.POLYGON][SystemKeys.COMMON] + const goerliCommon = ADDRESSES[Networks.GOERLI][SystemKeys.COMMON] + // const optimismGoerliCommon = ADDRESSES[Networks.OPTIMISM_GOERLI][SystemKeys.COMMON] + + + return { + [Networks.MAINNET]: [ + {[TokenSymbols.USDC]: tokens.USDC.setAddress(mainnetCommon.USDC).toObject()}, + {[TokenSymbols.WETH]: tokens.WETH.setAddress(mainnetCommon.WETH).toObject()}, + {[TokenSymbols.STETH]: tokens.STETH.setAddress(mainnetCommon.STETH).toObject()}, + {[TokenSymbols.WSTETH]: tokens.WSTETH.setAddress(mainnetCommon.WSTETH).toObject()}, + {[TokenSymbols.WBTC]: tokens.WBTC.setAddress(mainnetCommon.WBTC).toObject()}, + {[TokenSymbols.DAI]: tokens.DAI.setAddress(mainnetCommon.DAI).toObject()}, + {[TokenSymbols.CBETH]: tokens.CBETH.setAddress(mainnetCommon.CBETH).toObject()}, + {[TokenSymbols.RETH]: tokens.RETH.setAddress(mainnetCommon.RETH).toObject()}, + {[TokenSymbols.AAVE]: tokens.AAVE.setAddress(mainnetCommon.AAVE).toObject()}, + {[TokenSymbols.LINK]: tokens.LINK.setAddress(mainnetCommon.LINK).toObject()}, + {[TokenSymbols.UNI]: tokens.UNI.setAddress(mainnetCommon.UNI).toObject()}, + // {[TokenSymbols.SUSHI]: tokens.SUSHI.setAddress(mainnetCommon.SUSHI).toObject()}, + // {[TokenSymbols.CRV]: tokens.CRV.setAddress(mainnetCommon.CRV).toObject()}, + // {[TokenSymbols.SNX]: tokens.SNX.setAddress(mainnetCommon.SNX).toObject()}, + {[TokenSymbols.ADAI]: tokens.ADAI.setAddress(mainnetCommon.ADAI).toObject()}, + {[TokenSymbols.BAL]: tokens.BAL.setAddress(mainnetCommon.BAL).toObject()}, + {[TokenSymbols.BAT]: tokens.BAT.setAddress(mainnetCommon.BAT).toObject()}, + {[TokenSymbols.COMP]: tokens.COMP.setAddress(mainnetCommon.COMP).toObject()}, + {[TokenSymbols.CRVV1ETHSTETH]: tokens.CRVV1ETHSTETH.setAddress(mainnetCommon.CRVV1ETHSTETH).toObject()}, + {[TokenSymbols.FRAX]: tokens.FRAX.setAddress(mainnetCommon.FRAX).toObject()}, + {[TokenSymbols.GHO]: tokens.GHO.setAddress(mainnetCommon.GHO).toObject()}, + {[TokenSymbols.GUNIV3DAIUSDC1]: tokens.GUNIV3DAIUSDC1.setAddress(mainnetCommon.GUNIV3DAIUSDC1).toObject()}, + {[TokenSymbols.GUNIV3DAIUSDC2]: tokens.GUNIV3DAIUSDC2.setAddress(mainnetCommon.GUNIV3DAIUSDC2).toObject()}, + {[TokenSymbols.GUSD]: tokens.GUSD.setAddress(mainnetCommon.GUSD).toObject()}, + {[TokenSymbols.KNC]: tokens.KNC.setAddress(mainnetCommon.KNC).toObject()}, + {[TokenSymbols.LDO]: tokens.LRC.setAddress(mainnetCommon.LDO).toObject()}, + {[TokenSymbols.LRC]: tokens.LRC.setAddress(mainnetCommon.LRC).toObject()}, + {[TokenSymbols.LUSD]: tokens.LUSD.setAddress(mainnetCommon.LUSD).toObject()}, + {[TokenSymbols.MANA]: tokens.MANA.setAddress(mainnetCommon.MANA).toObject()}, + {[TokenSymbols.MATIC]: tokens.MATIC.setAddress(mainnetCommon.MATIC).toObject()}, + {[TokenSymbols.PAX]: tokens.PAX.setAddress(mainnetCommon.PAX).toObject()}, + {[TokenSymbols.PAXUSD]: tokens.PAXUSD.setAddress(mainnetCommon.PAXUSD).toObject()}, + {[TokenSymbols.RENBTC]: tokens.RENBTC.setAddress(mainnetCommon.RENBTC).toObject()}, + {[TokenSymbols.RWA001]: tokens.RWA001.setAddress(mainnetCommon.RWA001).toObject()}, + {[TokenSymbols.RWA002]: tokens.RWA002.setAddress(mainnetCommon.RWA002).toObject()}, + {[TokenSymbols.RWA003]: tokens.RWA003.setAddress(mainnetCommon.RWA003).toObject()}, + {[TokenSymbols.RWA004]: tokens.RWA004.setAddress(mainnetCommon.RWA004).toObject()}, + {[TokenSymbols.RWA005]: tokens.RWA005.setAddress(mainnetCommon.RWA005).toObject()}, + {[TokenSymbols.RWA006]: tokens.RWA006.setAddress(mainnetCommon.RWA006).toObject()}, + {[TokenSymbols.SDAI]: tokens.SDAI.setAddress(mainnetCommon.SDAI).toObject()}, + {[TokenSymbols.TBTC]: tokens.TBTC.setAddress(mainnetCommon.TBTC).toObject()}, + {[TokenSymbols.TUSD]: tokens.TUSD.setAddress(mainnetCommon.TUSD).toObject()}, + {[TokenSymbols.UNIV2AAVEETH]: tokens.UNIV2AAVEETH.setAddress(mainnetCommon.UNIV2AAVEETH).toObject()}, + {[TokenSymbols.UNIV2DAIETH]: tokens.UNIV2DAIETH.setAddress(mainnetCommon.UNIV2DAIETH).toObject()}, + {[TokenSymbols.UNIV2DAIUSDC]: tokens.UNIV2DAIUSDC.setAddress(mainnetCommon.UNIV2DAIUSDC).toObject()}, + {[TokenSymbols.UNIV2DAIUSDT]: tokens.UNIV2DAIUSDT.setAddress(mainnetCommon.UNIV2DAIUSDT).toObject()}, + {[TokenSymbols.UNIV2ETHUSDT]: tokens.UNIV2ETHUSDT.setAddress(mainnetCommon.UNIV2ETHUSDT).toObject()}, + {[TokenSymbols.UNIV2LINKETH]: tokens.UNIV2LINKETH.setAddress(mainnetCommon.UNIV2LINKETH).toObject()}, + {[TokenSymbols.UNIV2UNIETH]: tokens.UNIV2UNIETH.setAddress(mainnetCommon.UNIV2UNIETH).toObject()}, + {[TokenSymbols.UNIV2USDCETH]: tokens.UNIV2USDCETH.setAddress(mainnetCommon.UNIV2USDCETH).toObject()}, + {[TokenSymbols.UNIV2WBTCDAI]: tokens.UNIV2WBTCDAI.setAddress(mainnetCommon.UNIV2WBTCDAI).toObject()}, + {[TokenSymbols.UNIV2WBTCETH]: tokens.UNIV2WBTCETH.setAddress(mainnetCommon.UNIV2WBTCETH).toObject()}, + {[TokenSymbols.USDT]: tokens.USDT.setAddress(mainnetCommon.USDT).toObject()}, + {[TokenSymbols.WLD]: tokens.WLD.setAddress(mainnetCommon.WLD).toObject()}, + {[TokenSymbols.YIELDBTC]: tokens.YIELDBTC.setAddress(mainnetCommon.YIELDBTC).toObject()}, + {[TokenSymbols.YIELDETH]: tokens.YIELDETH.setAddress(mainnetCommon.YIELDETH).toObject()}, + {[TokenSymbols.YFI]: tokens.YFI.setAddress(mainnetCommon.YFI).toObject()}, + {[TokenSymbols.ZRX]: tokens.ZRX.setAddress(mainnetCommon.ZRX).toObject()}, + ], + [Networks.OPTIMISM]: [ + {[TokenSymbols.USDC]: tokens.USDC.setAddress(optimismCommon.USDC).toObject()}, + {[TokenSymbols.WETH]: tokens.WETH.setAddress(optimismCommon.WETH).toObject()}, + {[TokenSymbols.STETH]: tokens.STETH.setAddress(optimismCommon.STETH).toObject()}, + {[TokenSymbols.WSTETH]: tokens.WSTETH.setAddress(optimismCommon.WSTETH).toObject()}, + {[TokenSymbols.WBTC]: tokens.WBTC.setAddress(optimismCommon.WBTC).toObject()}, + {[TokenSymbols.DAI]: tokens.DAI.setAddress(optimismCommon.DAI).toObject()}, + {[TokenSymbols.CBETH]: tokens.CBETH.setAddress(optimismCommon.CBETH).toObject()}, + {[TokenSymbols.RETH]: tokens.RETH.setAddress(optimismCommon.RETH).toObject()}, + {[TokenSymbols.AAVE]: tokens.AAVE.setAddress(optimismCommon.AAVE).toObject()}, + {[TokenSymbols.LINK]: tokens.LINK.setAddress(optimismCommon.LINK).toObject()}, + {[TokenSymbols.UNI]: tokens.UNI.setAddress(optimismCommon.UNI).toObject()}, + // {[TokenSymbols.SUSHI]: tokens.SUSHI.setAddress(optimismCommon.SUSHI).toObject()}, + // {[TokenSymbols.CRV]: tokens.CRV.setAddress(optimismCommon.CRV).toObject()}, + // {[TokenSymbols.SNX]: tokens.SNX.setAddress(optimismCommon.SNX).toObject()}, + {[TokenSymbols.ADAI]: tokens.ADAI.setAddress(optimismCommon.ADAI).toObject()}, + {[TokenSymbols.BAL]: tokens.BAL.setAddress(optimismCommon.BAL).toObject()}, + {[TokenSymbols.BAT]: tokens.BAT.setAddress(optimismCommon.BAT).toObject()}, + {[TokenSymbols.COMP]: tokens.COMP.setAddress(optimismCommon.COMP).toObject()}, + {[TokenSymbols.CRVV1ETHSTETH]: tokens.CRVV1ETHSTETH.setAddress(optimismCommon.CRVV1ETHSTETH).toObject()}, + {[TokenSymbols.FRAX]: tokens.FRAX.setAddress(optimismCommon.FRAX).toObject()}, + {[TokenSymbols.GHO]: tokens.GHO.setAddress(optimismCommon.GHO).toObject()}, + {[TokenSymbols.GUNIV3DAIUSDC1]: tokens.GUNIV3DAIUSDC1.setAddress(optimismCommon.GUNIV3DAIUSDC1).toObject()}, + {[TokenSymbols.GUNIV3DAIUSDC2]: tokens.GUNIV3DAIUSDC2.setAddress(optimismCommon.GUNIV3DAIUSDC2).toObject()}, + {[TokenSymbols.GUSD]: tokens.GUSD.setAddress(optimismCommon.GUSD).toObject()}, + {[TokenSymbols.KNC]: tokens.KNC.setAddress(optimismCommon.KNC).toObject()}, + {[TokenSymbols.LDO]: tokens.LRC.setAddress(optimismCommon.LDO).toObject()}, + {[TokenSymbols.LRC]: tokens.LRC.setAddress(optimismCommon.LRC).toObject()}, + {[TokenSymbols.LUSD]: tokens.LUSD.setAddress(optimismCommon.LUSD).toObject()}, + {[TokenSymbols.MANA]: tokens.MANA.setAddress(optimismCommon.MANA).toObject()}, + {[TokenSymbols.MATIC]: tokens.MATIC.setAddress(optimismCommon.MATIC).toObject()}, + {[TokenSymbols.PAX]: tokens.PAX.setAddress(optimismCommon.PAX).toObject()}, + {[TokenSymbols.PAXUSD]: tokens.PAXUSD.setAddress(optimismCommon.PAXUSD).toObject()}, + {[TokenSymbols.RENBTC]: tokens.RENBTC.setAddress(optimismCommon.RENBTC).toObject()}, + {[TokenSymbols.RWA001]: tokens.RWA001.setAddress(optimismCommon.RWA001).toObject()}, + {[TokenSymbols.RWA002]: tokens.RWA002.setAddress(optimismCommon.RWA002).toObject()}, + {[TokenSymbols.RWA003]: tokens.RWA003.setAddress(optimismCommon.RWA003).toObject()}, + {[TokenSymbols.RWA004]: tokens.RWA004.setAddress(optimismCommon.RWA004).toObject()}, + {[TokenSymbols.RWA005]: tokens.RWA005.setAddress(optimismCommon.RWA005).toObject()}, + {[TokenSymbols.RWA006]: tokens.RWA006.setAddress(optimismCommon.RWA006).toObject()}, + {[TokenSymbols.SDAI]: tokens.SDAI.setAddress(optimismCommon.SDAI).toObject()}, + {[TokenSymbols.TBTC]: tokens.TBTC.setAddress(optimismCommon.TBTC).toObject()}, + {[TokenSymbols.TUSD]: tokens.TUSD.setAddress(optimismCommon.TUSD).toObject()}, + {[TokenSymbols.UNIV2AAVEETH]: tokens.UNIV2AAVEETH.setAddress(optimismCommon.UNIV2AAVEETH).toObject()}, + {[TokenSymbols.UNIV2DAIETH]: tokens.UNIV2DAIETH.setAddress(optimismCommon.UNIV2DAIETH).toObject()}, + {[TokenSymbols.UNIV2DAIUSDC]: tokens.UNIV2DAIUSDC.setAddress(optimismCommon.UNIV2DAIUSDC).toObject()}, + {[TokenSymbols.UNIV2DAIUSDT]: tokens.UNIV2DAIUSDT.setAddress(optimismCommon.UNIV2DAIUSDT).toObject()}, + {[TokenSymbols.UNIV2ETHUSDT]: tokens.UNIV2ETHUSDT.setAddress(optimismCommon.UNIV2ETHUSDT).toObject()}, + {[TokenSymbols.UNIV2LINKETH]: tokens.UNIV2LINKETH.setAddress(optimismCommon.UNIV2LINKETH).toObject()}, + {[TokenSymbols.UNIV2UNIETH]: tokens.UNIV2UNIETH.setAddress(optimismCommon.UNIV2UNIETH).toObject()}, + {[TokenSymbols.UNIV2USDCETH]: tokens.UNIV2USDCETH.setAddress(optimismCommon.UNIV2USDCETH).toObject()}, + {[TokenSymbols.UNIV2WBTCDAI]: tokens.UNIV2WBTCDAI.setAddress(optimismCommon.UNIV2WBTCDAI).toObject()}, + {[TokenSymbols.UNIV2WBTCETH]: tokens.UNIV2WBTCETH.setAddress(optimismCommon.UNIV2WBTCETH).toObject()}, + {[TokenSymbols.USDT]: tokens.USDT.setAddress(optimismCommon.USDT).toObject()}, + {[TokenSymbols.WLD]: tokens.WLD.setAddress(optimismCommon.WLD).toObject()}, + {[TokenSymbols.YIELDBTC]: tokens.YIELDBTC.setAddress(optimismCommon.YIELDBTC).toObject()}, + {[TokenSymbols.YIELDETH]: tokens.YIELDETH.setAddress(optimismCommon.YIELDETH).toObject()}, + {[TokenSymbols.YFI]: tokens.YFI.setAddress(optimismCommon.YFI).toObject()}, + {[TokenSymbols.ZRX]: tokens.ZRX.setAddress(optimismCommon.ZRX).toObject()}, + ], + [Networks.ARBITRUM]: [ + {[TokenSymbols.USDC]: tokens.USDC.setAddress(arbitrumCommon.USDC).toObject()}, + {[TokenSymbols.WETH]: tokens.WETH.setAddress(arbitrumCommon.WETH).toObject()}, + {[TokenSymbols.STETH]: tokens.STETH.setAddress(arbitrumCommon.STETH).toObject()}, + {[TokenSymbols.WSTETH]: tokens.WSTETH.setAddress(arbitrumCommon.WSTETH).toObject()}, + {[TokenSymbols.WBTC]: tokens.WBTC.setAddress(arbitrumCommon.WBTC).toObject()}, + {[TokenSymbols.DAI]: tokens.DAI.setAddress(arbitrumCommon.DAI).toObject()}, + {[TokenSymbols.CBETH]: tokens.CBETH.setAddress(arbitrumCommon.CBETH).toObject()}, + {[TokenSymbols.RETH]: tokens.RETH.setAddress(arbitrumCommon.RETH).toObject()}, + {[TokenSymbols.AAVE]: tokens.AAVE.setAddress(arbitrumCommon.AAVE).toObject()}, + {[TokenSymbols.LINK]: tokens.LINK.setAddress(arbitrumCommon.LINK).toObject()}, + {[TokenSymbols.UNI]: tokens.UNI.setAddress(arbitrumCommon.UNI).toObject()}, + // {[TokenSymbols.SUSHI]: tokens.SUSHI.setAddress(arbitrumCommon.SUSHI).toObject()}, + // {[TokenSymbols.CRV]: tokens.CRV.setAddress(arbitrumCommon.CRV).toObject()}, + // {[TokenSymbols.SNX]: tokens.SNX.setAddress(arbitrumCommon.SNX).toObject()}, + {[TokenSymbols.ADAI]: tokens.ADAI.setAddress(arbitrumCommon.ADAI).toObject()}, + {[TokenSymbols.BAL]: tokens.BAL.setAddress(arbitrumCommon.BAL).toObject()}, + {[TokenSymbols.BAT]: tokens.BAT.setAddress(arbitrumCommon.BAT).toObject()}, + {[TokenSymbols.COMP]: tokens.COMP.setAddress(arbitrumCommon.COMP).toObject()}, + {[TokenSymbols.CRVV1ETHSTETH]: tokens.CRVV1ETHSTETH.setAddress(arbitrumCommon.CRVV1ETHSTETH).toObject()}, + {[TokenSymbols.FRAX]: tokens.FRAX.setAddress(arbitrumCommon.FRAX).toObject()}, + {[TokenSymbols.GHO]: tokens.GHO.setAddress(arbitrumCommon.GHO).toObject()}, + {[TokenSymbols.GUNIV3DAIUSDC1]: tokens.GUNIV3DAIUSDC1.setAddress(arbitrumCommon.GUNIV3DAIUSDC1).toObject()}, + {[TokenSymbols.GUNIV3DAIUSDC2]: tokens.GUNIV3DAIUSDC2.setAddress(arbitrumCommon.GUNIV3DAIUSDC2).toObject()}, + {[TokenSymbols.GUSD]: tokens.GUSD.setAddress(arbitrumCommon.GUSD).toObject()}, + {[TokenSymbols.KNC]: tokens.KNC.setAddress(arbitrumCommon.KNC).toObject()}, + {[TokenSymbols.LDO]: tokens.LRC.setAddress(arbitrumCommon.LDO).toObject()}, + {[TokenSymbols.LRC]: tokens.LRC.setAddress(arbitrumCommon.LRC).toObject()}, + {[TokenSymbols.LUSD]: tokens.LUSD.setAddress(arbitrumCommon.LUSD).toObject()}, + {[TokenSymbols.MANA]: tokens.MANA.setAddress(arbitrumCommon.MANA).toObject()}, + {[TokenSymbols.MATIC]: tokens.MATIC.setAddress(arbitrumCommon.MATIC).toObject()}, + {[TokenSymbols.PAX]: tokens.PAX.setAddress(arbitrumCommon.PAX).toObject()}, + {[TokenSymbols.PAXUSD]: tokens.PAXUSD.setAddress(arbitrumCommon.PAXUSD).toObject()}, + {[TokenSymbols.RENBTC]: tokens.RENBTC.setAddress(arbitrumCommon.RENBTC).toObject()}, + {[TokenSymbols.RWA001]: tokens.RWA001.setAddress(arbitrumCommon.RWA001).toObject()}, + {[TokenSymbols.RWA002]: tokens.RWA002.setAddress(arbitrumCommon.RWA002).toObject()}, + {[TokenSymbols.RWA003]: tokens.RWA003.setAddress(arbitrumCommon.RWA003).toObject()}, + {[TokenSymbols.RWA004]: tokens.RWA004.setAddress(arbitrumCommon.RWA004).toObject()}, + {[TokenSymbols.RWA005]: tokens.RWA005.setAddress(arbitrumCommon.RWA005).toObject()}, + {[TokenSymbols.RWA006]: tokens.RWA006.setAddress(arbitrumCommon.RWA006).toObject()}, + {[TokenSymbols.SDAI]: tokens.SDAI.setAddress(arbitrumCommon.SDAI).toObject()}, + {[TokenSymbols.TBTC]: tokens.TBTC.setAddress(arbitrumCommon.TBTC).toObject()}, + {[TokenSymbols.TUSD]: tokens.TUSD.setAddress(arbitrumCommon.TUSD).toObject()}, + {[TokenSymbols.UNIV2AAVEETH]: tokens.UNIV2AAVEETH.setAddress(arbitrumCommon.UNIV2AAVEETH).toObject()}, + {[TokenSymbols.UNIV2DAIETH]: tokens.UNIV2DAIETH.setAddress(arbitrumCommon.UNIV2DAIETH).toObject()}, + {[TokenSymbols.UNIV2DAIUSDC]: tokens.UNIV2DAIUSDC.setAddress(arbitrumCommon.UNIV2DAIUSDC).toObject()}, + {[TokenSymbols.UNIV2DAIUSDT]: tokens.UNIV2DAIUSDT.setAddress(arbitrumCommon.UNIV2DAIUSDT).toObject()}, + {[TokenSymbols.UNIV2ETHUSDT]: tokens.UNIV2ETHUSDT.setAddress(arbitrumCommon.UNIV2ETHUSDT).toObject()}, + {[TokenSymbols.UNIV2LINKETH]: tokens.UNIV2LINKETH.setAddress(arbitrumCommon.UNIV2LINKETH).toObject()}, + {[TokenSymbols.UNIV2UNIETH]: tokens.UNIV2UNIETH.setAddress(arbitrumCommon.UNIV2UNIETH).toObject()}, + {[TokenSymbols.UNIV2USDCETH]: tokens.UNIV2USDCETH.setAddress(arbitrumCommon.UNIV2USDCETH).toObject()}, + {[TokenSymbols.UNIV2WBTCDAI]: tokens.UNIV2WBTCDAI.setAddress(arbitrumCommon.UNIV2WBTCDAI).toObject()}, + {[TokenSymbols.UNIV2WBTCETH]: tokens.UNIV2WBTCETH.setAddress(arbitrumCommon.UNIV2WBTCETH).toObject()}, + {[TokenSymbols.USDT]: tokens.USDT.setAddress(arbitrumCommon.USDT).toObject()}, + {[TokenSymbols.WLD]: tokens.WLD.setAddress(arbitrumCommon.WLD).toObject()}, + {[TokenSymbols.YIELDBTC]: tokens.YIELDBTC.setAddress(arbitrumCommon.YIELDBTC).toObject()}, + {[TokenSymbols.YIELDETH]: tokens.YIELDETH.setAddress(arbitrumCommon.YIELDETH).toObject()}, + {[TokenSymbols.YFI]: tokens.YFI.setAddress(arbitrumCommon.YFI).toObject()}, + {[TokenSymbols.ZRX]: tokens.ZRX.setAddress(arbitrumCommon.ZRX).toObject()}, + ], + [Networks.BASE]: [], + [Networks.POLYGON]: [], + [Networks.GOERLI]: [ + {[TokenSymbols.USDC]: tokens.USDC.setAddress(goerliCommon.USDC).toObject()}, + {[TokenSymbols.WETH]: tokens.WETH.setAddress(goerliCommon.WETH).toObject()}, + {[TokenSymbols.STETH]: tokens.STETH.setAddress(goerliCommon.STETH).toObject()}, + {[TokenSymbols.WSTETH]: tokens.WSTETH.setAddress(goerliCommon.WSTETH).toObject()}, + {[TokenSymbols.WBTC]: tokens.WBTC.setAddress(goerliCommon.WBTC).toObject()}, + {[TokenSymbols.DAI]: tokens.DAI.setAddress(goerliCommon.DAI).toObject()}, + {[TokenSymbols.CBETH]: tokens.CBETH.setAddress(goerliCommon.CBETH).toObject()}, + {[TokenSymbols.RETH]: tokens.RETH.setAddress(goerliCommon.RETH).toObject()}, + {[TokenSymbols.AAVE]: tokens.AAVE.setAddress(goerliCommon.AAVE).toObject()}, + {[TokenSymbols.LINK]: tokens.LINK.setAddress(goerliCommon.LINK).toObject()}, + {[TokenSymbols.UNI]: tokens.UNI.setAddress(goerliCommon.UNI).toObject()}, + // {[TokenSymbols.SUSHI]: tokens.SUSHI.setAddress(goerliCommon.SUSHI).toObject()}, + // {[TokenSymbols.CRV]: tokens.CRV.setAddress(goerliCommon.CRV).toObject()}, + // {[TokenSymbols.SNX]: tokens.SNX.setAddress(goerliCommon.SNX).toObject()}, + {[TokenSymbols.ADAI]: tokens.ADAI.setAddress(goerliCommon.ADAI).toObject()}, + {[TokenSymbols.BAL]: tokens.BAL.setAddress(goerliCommon.BAL).toObject()}, + {[TokenSymbols.BAT]: tokens.BAT.setAddress(goerliCommon.BAT).toObject()}, + {[TokenSymbols.COMP]: tokens.COMP.setAddress(goerliCommon.COMP).toObject()}, + {[TokenSymbols.CRVV1ETHSTETH]: tokens.CRVV1ETHSTETH.setAddress(goerliCommon.CRVV1ETHSTETH).toObject()}, + {[TokenSymbols.FRAX]: tokens.FRAX.setAddress(goerliCommon.FRAX).toObject()}, + {[TokenSymbols.GHO]: tokens.GHO.setAddress(goerliCommon.GHO).toObject()}, + {[TokenSymbols.GUNIV3DAIUSDC1]: tokens.GUNIV3DAIUSDC1.setAddress(goerliCommon.GUNIV3DAIUSDC1).toObject()}, + {[TokenSymbols.GUNIV3DAIUSDC2]: tokens.GUNIV3DAIUSDC2.setAddress(goerliCommon.GUNIV3DAIUSDC2).toObject()}, + {[TokenSymbols.GUSD]: tokens.GUSD.setAddress(goerliCommon.GUSD).toObject()}, + {[TokenSymbols.KNC]: tokens.KNC.setAddress(goerliCommon.KNC).toObject()}, + {[TokenSymbols.LDO]: tokens.LRC.setAddress(goerliCommon.LDO).toObject()}, + {[TokenSymbols.LRC]: tokens.LRC.setAddress(goerliCommon.LRC).toObject()}, + {[TokenSymbols.LUSD]: tokens.LUSD.setAddress(goerliCommon.LUSD).toObject()}, + {[TokenSymbols.MANA]: tokens.MANA.setAddress(goerliCommon.MANA).toObject()}, + {[TokenSymbols.MATIC]: tokens.MATIC.setAddress(goerliCommon.MATIC).toObject()}, + {[TokenSymbols.PAX]: tokens.PAX.setAddress(goerliCommon.PAX).toObject()}, + {[TokenSymbols.PAXUSD]: tokens.PAXUSD.setAddress(goerliCommon.PAXUSD).toObject()}, + {[TokenSymbols.RENBTC]: tokens.RENBTC.setAddress(goerliCommon.RENBTC).toObject()}, + {[TokenSymbols.RWA001]: tokens.RWA001.setAddress(goerliCommon.RWA001).toObject()}, + {[TokenSymbols.RWA002]: tokens.RWA002.setAddress(goerliCommon.RWA002).toObject()}, + {[TokenSymbols.RWA003]: tokens.RWA003.setAddress(goerliCommon.RWA003).toObject()}, + {[TokenSymbols.RWA004]: tokens.RWA004.setAddress(goerliCommon.RWA004).toObject()}, + {[TokenSymbols.RWA005]: tokens.RWA005.setAddress(goerliCommon.RWA005).toObject()}, + {[TokenSymbols.RWA006]: tokens.RWA006.setAddress(goerliCommon.RWA006).toObject()}, + {[TokenSymbols.SDAI]: tokens.SDAI.setAddress(goerliCommon.SDAI).toObject()}, + {[TokenSymbols.TBTC]: tokens.TBTC.setAddress(goerliCommon.TBTC).toObject()}, + {[TokenSymbols.TUSD]: tokens.TUSD.setAddress(goerliCommon.TUSD).toObject()}, + {[TokenSymbols.UNIV2AAVEETH]: tokens.UNIV2AAVEETH.setAddress(goerliCommon.UNIV2AAVEETH).toObject()}, + {[TokenSymbols.UNIV2DAIETH]: tokens.UNIV2DAIETH.setAddress(goerliCommon.UNIV2DAIETH).toObject()}, + {[TokenSymbols.UNIV2DAIUSDC]: tokens.UNIV2DAIUSDC.setAddress(goerliCommon.UNIV2DAIUSDC).toObject()}, + {[TokenSymbols.UNIV2DAIUSDT]: tokens.UNIV2DAIUSDT.setAddress(goerliCommon.UNIV2DAIUSDT).toObject()}, + {[TokenSymbols.UNIV2ETHUSDT]: tokens.UNIV2ETHUSDT.setAddress(goerliCommon.UNIV2ETHUSDT).toObject()}, + {[TokenSymbols.UNIV2LINKETH]: tokens.UNIV2LINKETH.setAddress(goerliCommon.UNIV2LINKETH).toObject()}, + {[TokenSymbols.UNIV2UNIETH]: tokens.UNIV2UNIETH.setAddress(goerliCommon.UNIV2UNIETH).toObject()}, + {[TokenSymbols.UNIV2USDCETH]: tokens.UNIV2USDCETH.setAddress(goerliCommon.UNIV2USDCETH).toObject()}, + {[TokenSymbols.UNIV2WBTCDAI]: tokens.UNIV2WBTCDAI.setAddress(goerliCommon.UNIV2WBTCDAI).toObject()}, + {[TokenSymbols.UNIV2WBTCETH]: tokens.UNIV2WBTCETH.setAddress(goerliCommon.UNIV2WBTCETH).toObject()}, + {[TokenSymbols.USDT]: tokens.USDT.setAddress(goerliCommon.USDT).toObject()}, + {[TokenSymbols.WLD]: tokens.WLD.setAddress(goerliCommon.WLD).toObject()}, + {[TokenSymbols.YIELDBTC]: tokens.YIELDBTC.setAddress(goerliCommon.YIELDBTC).toObject()}, + {[TokenSymbols.YIELDETH]: tokens.YIELDETH.setAddress(goerliCommon.YIELDETH).toObject()}, + {[TokenSymbols.YFI]: tokens.YFI.setAddress(goerliCommon.YFI).toObject()}, + {[TokenSymbols.ZRX]: tokens.ZRX.setAddress(goerliCommon.ZRX).toObject()}, + ], + [Networks.OPTIMISM_GOERLI]: [], + [Networks.ARBITRUM_GOERLI]: [], + [Networks.POLYGON_MUMBAI]: [], + } +}; \ No newline at end of file diff --git a/configs/domain/getTokens.ts b/configs/domain/get-tokens.ts similarity index 100% rename from configs/domain/getTokens.ts rename to configs/domain/get-tokens.ts diff --git a/configs/domain/getTokensByNetwork.ts b/configs/domain/getTokensByNetwork.ts deleted file mode 100644 index 571d34b..0000000 --- a/configs/domain/getTokensByNetwork.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {IToken, Networks, TokenSymbols, tokens} from "🤝"; - -type TokenSubset = { - [key in TokenSymbols]?: IToken; -}; - -type NetworkTokens = { - [network in Networks]: TokenSubset[]; -}; - -/** - * Returns tokens for each network - * Could be enhanced to return tokens with address - */ -export const getTokensByNetwork = (): NetworkTokens => { - return { - [Networks.MAINNET]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}, {[TokenSymbols.DAI]: tokens.DAI.setAddress('').toObject()}], - [Networks.OPTIMISM]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], - [Networks.ARBITRUM]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], - [Networks.BASE]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], - [Networks.POLYGON]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], - [Networks.GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], - [Networks.OPTIMISM_GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], - [Networks.ARBITRUM_GOERLI]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], - [Networks.POLYGON_MUMBAI]: [{[TokenSymbols.USDC]: tokens.USDC.setAddress('').toObject()}], - } -}; \ No newline at end of file diff --git a/configs/domain/index.ts b/configs/domain/index.ts index 831a4a3..a89ef7f 100644 --- a/configs/domain/index.ts +++ b/configs/domain/index.ts @@ -1,8 +1,8 @@ -import {getDenominationSymbols} from "./getDenominationSymbols"; -import {getLendingProtocols} from "./getLendingProtocols"; -import {getNetworks} from "./getNetworks"; -import {getTokens} from "./getTokens"; -import {getTokensByNetwork} from "./getTokensByNetwork"; +import {getDenominationSymbols} from "./get-denomination-symbols"; +import {getLendingProtocols} from "./get-lending-protocols"; +import {getNetworks} from "./get-networks"; +import {getTokens} from "./get-tokens"; +import {getTokensByNetwork} from "./get-tokens-by-network"; export default function () { /** diff --git a/package.json b/package.json index cc0bdd0..68374bf 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ }, "homepage": "https://github.com/OasisDEX/oazo-configuration#readme", "dependencies": { + "@oasisdex/addresses": "0.1.5", "@types/node": "^20.5.9", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", From 2835564f159ecf9790237756da2d385402308e43 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Thu, 12 Oct 2023 16:00:11 +0100 Subject: [PATCH 10/17] refactor: minor refactor of OB config to use shared enums --- configs/oasis-borrow/getNavigation.ts | 6 ++++-- configs/oasis-borrow/getParameters.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configs/oasis-borrow/getNavigation.ts b/configs/oasis-borrow/getNavigation.ts index 9b4b38b..ad75535 100644 --- a/configs/oasis-borrow/getNavigation.ts +++ b/configs/oasis-borrow/getNavigation.ts @@ -1,3 +1,5 @@ +import {TokenSymbols} from "🤝"; + export const getNavigation= () => ({ protocols: { ajna: { @@ -70,7 +72,7 @@ export const getNavigation= () => ({ }, }, tokens: { - popular: ['ETH', 'STETH', 'RETH', 'CBETH', 'DAI', 'WBTC', 'USDC'], - new: ['SDAI'], + popular: [TokenSymbols.ETH, TokenSymbols.STETH, TokenSymbols.RETH, TokenSymbols.CBETH, TokenSymbols.DAI, TokenSymbols.WBTC, TokenSymbols.USDC], + new: [TokenSymbols.SDAI], }, }) \ No newline at end of file diff --git a/configs/oasis-borrow/getParameters.ts b/configs/oasis-borrow/getParameters.ts index 0d72120..236848e 100644 --- a/configs/oasis-borrow/getParameters.ts +++ b/configs/oasis-borrow/getParameters.ts @@ -1,4 +1,5 @@ import { ConfigHelperType } from "⌨️"; +import {TokenSymbols} from "🤝"; export const getParameters = ({ notProduction, @@ -13,7 +14,7 @@ export const getParameters = ({ showFlashloanInformation: notProduction, }, closeDisabledFor: { - collateral: ["DAI", "USDC"], + collateral: [TokenSymbols.DAI, TokenSymbols.USDC], strategyTypes: ["short"], }, adjustDisabledFor: { From d8c08a8e805caabbaa5243dd83fb64a27c6e3fde Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Fri, 13 Oct 2023 09:25:28 +0100 Subject: [PATCH 11/17] feat: add addresses to tokensByNetwork --- configs/domain/get-tokens-by-network.ts | 263 +++--------------------- helpers/constants.ts | 2 + helpers/index.ts | 12 +- 3 files changed, 35 insertions(+), 242 deletions(-) diff --git a/configs/domain/get-tokens-by-network.ts b/configs/domain/get-tokens-by-network.ts index bacaf15..094a92a 100644 --- a/configs/domain/get-tokens-by-network.ts +++ b/configs/domain/get-tokens-by-network.ts @@ -1,5 +1,5 @@ -import {ADDRESSES, SystemKeys} from '@oasisdex/addresses' -import {IToken, Networks, TokenSymbols, tokens} from "🤝"; +import {ADDRESSES, ADDRESS_ZERO, Common, SystemKeys} from '@oasisdex/addresses' +import {IToken, Networks, TokenSymbols, Tokens, tokens} from "🤝"; type TokenSubset = { [key in TokenSymbols]?: IToken; @@ -22,252 +22,43 @@ export const getTokensByNetwork = (): NetworkTokens => { const goerliCommon = ADDRESSES[Networks.GOERLI][SystemKeys.COMMON] // const optimismGoerliCommon = ADDRESSES[Networks.OPTIMISM_GOERLI][SystemKeys.COMMON] - return { [Networks.MAINNET]: [ - {[TokenSymbols.USDC]: tokens.USDC.setAddress(mainnetCommon.USDC).toObject()}, - {[TokenSymbols.WETH]: tokens.WETH.setAddress(mainnetCommon.WETH).toObject()}, - {[TokenSymbols.STETH]: tokens.STETH.setAddress(mainnetCommon.STETH).toObject()}, - {[TokenSymbols.WSTETH]: tokens.WSTETH.setAddress(mainnetCommon.WSTETH).toObject()}, - {[TokenSymbols.WBTC]: tokens.WBTC.setAddress(mainnetCommon.WBTC).toObject()}, - {[TokenSymbols.DAI]: tokens.DAI.setAddress(mainnetCommon.DAI).toObject()}, - {[TokenSymbols.CBETH]: tokens.CBETH.setAddress(mainnetCommon.CBETH).toObject()}, - {[TokenSymbols.RETH]: tokens.RETH.setAddress(mainnetCommon.RETH).toObject()}, - {[TokenSymbols.AAVE]: tokens.AAVE.setAddress(mainnetCommon.AAVE).toObject()}, - {[TokenSymbols.LINK]: tokens.LINK.setAddress(mainnetCommon.LINK).toObject()}, - {[TokenSymbols.UNI]: tokens.UNI.setAddress(mainnetCommon.UNI).toObject()}, - // {[TokenSymbols.SUSHI]: tokens.SUSHI.setAddress(mainnetCommon.SUSHI).toObject()}, - // {[TokenSymbols.CRV]: tokens.CRV.setAddress(mainnetCommon.CRV).toObject()}, - // {[TokenSymbols.SNX]: tokens.SNX.setAddress(mainnetCommon.SNX).toObject()}, - {[TokenSymbols.ADAI]: tokens.ADAI.setAddress(mainnetCommon.ADAI).toObject()}, - {[TokenSymbols.BAL]: tokens.BAL.setAddress(mainnetCommon.BAL).toObject()}, - {[TokenSymbols.BAT]: tokens.BAT.setAddress(mainnetCommon.BAT).toObject()}, - {[TokenSymbols.COMP]: tokens.COMP.setAddress(mainnetCommon.COMP).toObject()}, - {[TokenSymbols.CRVV1ETHSTETH]: tokens.CRVV1ETHSTETH.setAddress(mainnetCommon.CRVV1ETHSTETH).toObject()}, - {[TokenSymbols.FRAX]: tokens.FRAX.setAddress(mainnetCommon.FRAX).toObject()}, - {[TokenSymbols.GHO]: tokens.GHO.setAddress(mainnetCommon.GHO).toObject()}, - {[TokenSymbols.GUNIV3DAIUSDC1]: tokens.GUNIV3DAIUSDC1.setAddress(mainnetCommon.GUNIV3DAIUSDC1).toObject()}, - {[TokenSymbols.GUNIV3DAIUSDC2]: tokens.GUNIV3DAIUSDC2.setAddress(mainnetCommon.GUNIV3DAIUSDC2).toObject()}, - {[TokenSymbols.GUSD]: tokens.GUSD.setAddress(mainnetCommon.GUSD).toObject()}, - {[TokenSymbols.KNC]: tokens.KNC.setAddress(mainnetCommon.KNC).toObject()}, - {[TokenSymbols.LDO]: tokens.LRC.setAddress(mainnetCommon.LDO).toObject()}, - {[TokenSymbols.LRC]: tokens.LRC.setAddress(mainnetCommon.LRC).toObject()}, - {[TokenSymbols.LUSD]: tokens.LUSD.setAddress(mainnetCommon.LUSD).toObject()}, - {[TokenSymbols.MANA]: tokens.MANA.setAddress(mainnetCommon.MANA).toObject()}, - {[TokenSymbols.MATIC]: tokens.MATIC.setAddress(mainnetCommon.MATIC).toObject()}, - {[TokenSymbols.PAX]: tokens.PAX.setAddress(mainnetCommon.PAX).toObject()}, - {[TokenSymbols.PAXUSD]: tokens.PAXUSD.setAddress(mainnetCommon.PAXUSD).toObject()}, - {[TokenSymbols.RENBTC]: tokens.RENBTC.setAddress(mainnetCommon.RENBTC).toObject()}, - {[TokenSymbols.RWA001]: tokens.RWA001.setAddress(mainnetCommon.RWA001).toObject()}, - {[TokenSymbols.RWA002]: tokens.RWA002.setAddress(mainnetCommon.RWA002).toObject()}, - {[TokenSymbols.RWA003]: tokens.RWA003.setAddress(mainnetCommon.RWA003).toObject()}, - {[TokenSymbols.RWA004]: tokens.RWA004.setAddress(mainnetCommon.RWA004).toObject()}, - {[TokenSymbols.RWA005]: tokens.RWA005.setAddress(mainnetCommon.RWA005).toObject()}, - {[TokenSymbols.RWA006]: tokens.RWA006.setAddress(mainnetCommon.RWA006).toObject()}, - {[TokenSymbols.SDAI]: tokens.SDAI.setAddress(mainnetCommon.SDAI).toObject()}, - {[TokenSymbols.TBTC]: tokens.TBTC.setAddress(mainnetCommon.TBTC).toObject()}, - {[TokenSymbols.TUSD]: tokens.TUSD.setAddress(mainnetCommon.TUSD).toObject()}, - {[TokenSymbols.UNIV2AAVEETH]: tokens.UNIV2AAVEETH.setAddress(mainnetCommon.UNIV2AAVEETH).toObject()}, - {[TokenSymbols.UNIV2DAIETH]: tokens.UNIV2DAIETH.setAddress(mainnetCommon.UNIV2DAIETH).toObject()}, - {[TokenSymbols.UNIV2DAIUSDC]: tokens.UNIV2DAIUSDC.setAddress(mainnetCommon.UNIV2DAIUSDC).toObject()}, - {[TokenSymbols.UNIV2DAIUSDT]: tokens.UNIV2DAIUSDT.setAddress(mainnetCommon.UNIV2DAIUSDT).toObject()}, - {[TokenSymbols.UNIV2ETHUSDT]: tokens.UNIV2ETHUSDT.setAddress(mainnetCommon.UNIV2ETHUSDT).toObject()}, - {[TokenSymbols.UNIV2LINKETH]: tokens.UNIV2LINKETH.setAddress(mainnetCommon.UNIV2LINKETH).toObject()}, - {[TokenSymbols.UNIV2UNIETH]: tokens.UNIV2UNIETH.setAddress(mainnetCommon.UNIV2UNIETH).toObject()}, - {[TokenSymbols.UNIV2USDCETH]: tokens.UNIV2USDCETH.setAddress(mainnetCommon.UNIV2USDCETH).toObject()}, - {[TokenSymbols.UNIV2WBTCDAI]: tokens.UNIV2WBTCDAI.setAddress(mainnetCommon.UNIV2WBTCDAI).toObject()}, - {[TokenSymbols.UNIV2WBTCETH]: tokens.UNIV2WBTCETH.setAddress(mainnetCommon.UNIV2WBTCETH).toObject()}, - {[TokenSymbols.USDT]: tokens.USDT.setAddress(mainnetCommon.USDT).toObject()}, - {[TokenSymbols.WLD]: tokens.WLD.setAddress(mainnetCommon.WLD).toObject()}, - {[TokenSymbols.YIELDBTC]: tokens.YIELDBTC.setAddress(mainnetCommon.YIELDBTC).toObject()}, - {[TokenSymbols.YIELDETH]: tokens.YIELDETH.setAddress(mainnetCommon.YIELDETH).toObject()}, - {[TokenSymbols.YFI]: tokens.YFI.setAddress(mainnetCommon.YFI).toObject()}, - {[TokenSymbols.ZRX]: tokens.ZRX.setAddress(mainnetCommon.ZRX).toObject()}, + ...generateEntries(tokens, mainnetCommon) ], [Networks.OPTIMISM]: [ - {[TokenSymbols.USDC]: tokens.USDC.setAddress(optimismCommon.USDC).toObject()}, - {[TokenSymbols.WETH]: tokens.WETH.setAddress(optimismCommon.WETH).toObject()}, - {[TokenSymbols.STETH]: tokens.STETH.setAddress(optimismCommon.STETH).toObject()}, - {[TokenSymbols.WSTETH]: tokens.WSTETH.setAddress(optimismCommon.WSTETH).toObject()}, - {[TokenSymbols.WBTC]: tokens.WBTC.setAddress(optimismCommon.WBTC).toObject()}, - {[TokenSymbols.DAI]: tokens.DAI.setAddress(optimismCommon.DAI).toObject()}, - {[TokenSymbols.CBETH]: tokens.CBETH.setAddress(optimismCommon.CBETH).toObject()}, - {[TokenSymbols.RETH]: tokens.RETH.setAddress(optimismCommon.RETH).toObject()}, - {[TokenSymbols.AAVE]: tokens.AAVE.setAddress(optimismCommon.AAVE).toObject()}, - {[TokenSymbols.LINK]: tokens.LINK.setAddress(optimismCommon.LINK).toObject()}, - {[TokenSymbols.UNI]: tokens.UNI.setAddress(optimismCommon.UNI).toObject()}, - // {[TokenSymbols.SUSHI]: tokens.SUSHI.setAddress(optimismCommon.SUSHI).toObject()}, - // {[TokenSymbols.CRV]: tokens.CRV.setAddress(optimismCommon.CRV).toObject()}, - // {[TokenSymbols.SNX]: tokens.SNX.setAddress(optimismCommon.SNX).toObject()}, - {[TokenSymbols.ADAI]: tokens.ADAI.setAddress(optimismCommon.ADAI).toObject()}, - {[TokenSymbols.BAL]: tokens.BAL.setAddress(optimismCommon.BAL).toObject()}, - {[TokenSymbols.BAT]: tokens.BAT.setAddress(optimismCommon.BAT).toObject()}, - {[TokenSymbols.COMP]: tokens.COMP.setAddress(optimismCommon.COMP).toObject()}, - {[TokenSymbols.CRVV1ETHSTETH]: tokens.CRVV1ETHSTETH.setAddress(optimismCommon.CRVV1ETHSTETH).toObject()}, - {[TokenSymbols.FRAX]: tokens.FRAX.setAddress(optimismCommon.FRAX).toObject()}, - {[TokenSymbols.GHO]: tokens.GHO.setAddress(optimismCommon.GHO).toObject()}, - {[TokenSymbols.GUNIV3DAIUSDC1]: tokens.GUNIV3DAIUSDC1.setAddress(optimismCommon.GUNIV3DAIUSDC1).toObject()}, - {[TokenSymbols.GUNIV3DAIUSDC2]: tokens.GUNIV3DAIUSDC2.setAddress(optimismCommon.GUNIV3DAIUSDC2).toObject()}, - {[TokenSymbols.GUSD]: tokens.GUSD.setAddress(optimismCommon.GUSD).toObject()}, - {[TokenSymbols.KNC]: tokens.KNC.setAddress(optimismCommon.KNC).toObject()}, - {[TokenSymbols.LDO]: tokens.LRC.setAddress(optimismCommon.LDO).toObject()}, - {[TokenSymbols.LRC]: tokens.LRC.setAddress(optimismCommon.LRC).toObject()}, - {[TokenSymbols.LUSD]: tokens.LUSD.setAddress(optimismCommon.LUSD).toObject()}, - {[TokenSymbols.MANA]: tokens.MANA.setAddress(optimismCommon.MANA).toObject()}, - {[TokenSymbols.MATIC]: tokens.MATIC.setAddress(optimismCommon.MATIC).toObject()}, - {[TokenSymbols.PAX]: tokens.PAX.setAddress(optimismCommon.PAX).toObject()}, - {[TokenSymbols.PAXUSD]: tokens.PAXUSD.setAddress(optimismCommon.PAXUSD).toObject()}, - {[TokenSymbols.RENBTC]: tokens.RENBTC.setAddress(optimismCommon.RENBTC).toObject()}, - {[TokenSymbols.RWA001]: tokens.RWA001.setAddress(optimismCommon.RWA001).toObject()}, - {[TokenSymbols.RWA002]: tokens.RWA002.setAddress(optimismCommon.RWA002).toObject()}, - {[TokenSymbols.RWA003]: tokens.RWA003.setAddress(optimismCommon.RWA003).toObject()}, - {[TokenSymbols.RWA004]: tokens.RWA004.setAddress(optimismCommon.RWA004).toObject()}, - {[TokenSymbols.RWA005]: tokens.RWA005.setAddress(optimismCommon.RWA005).toObject()}, - {[TokenSymbols.RWA006]: tokens.RWA006.setAddress(optimismCommon.RWA006).toObject()}, - {[TokenSymbols.SDAI]: tokens.SDAI.setAddress(optimismCommon.SDAI).toObject()}, - {[TokenSymbols.TBTC]: tokens.TBTC.setAddress(optimismCommon.TBTC).toObject()}, - {[TokenSymbols.TUSD]: tokens.TUSD.setAddress(optimismCommon.TUSD).toObject()}, - {[TokenSymbols.UNIV2AAVEETH]: tokens.UNIV2AAVEETH.setAddress(optimismCommon.UNIV2AAVEETH).toObject()}, - {[TokenSymbols.UNIV2DAIETH]: tokens.UNIV2DAIETH.setAddress(optimismCommon.UNIV2DAIETH).toObject()}, - {[TokenSymbols.UNIV2DAIUSDC]: tokens.UNIV2DAIUSDC.setAddress(optimismCommon.UNIV2DAIUSDC).toObject()}, - {[TokenSymbols.UNIV2DAIUSDT]: tokens.UNIV2DAIUSDT.setAddress(optimismCommon.UNIV2DAIUSDT).toObject()}, - {[TokenSymbols.UNIV2ETHUSDT]: tokens.UNIV2ETHUSDT.setAddress(optimismCommon.UNIV2ETHUSDT).toObject()}, - {[TokenSymbols.UNIV2LINKETH]: tokens.UNIV2LINKETH.setAddress(optimismCommon.UNIV2LINKETH).toObject()}, - {[TokenSymbols.UNIV2UNIETH]: tokens.UNIV2UNIETH.setAddress(optimismCommon.UNIV2UNIETH).toObject()}, - {[TokenSymbols.UNIV2USDCETH]: tokens.UNIV2USDCETH.setAddress(optimismCommon.UNIV2USDCETH).toObject()}, - {[TokenSymbols.UNIV2WBTCDAI]: tokens.UNIV2WBTCDAI.setAddress(optimismCommon.UNIV2WBTCDAI).toObject()}, - {[TokenSymbols.UNIV2WBTCETH]: tokens.UNIV2WBTCETH.setAddress(optimismCommon.UNIV2WBTCETH).toObject()}, - {[TokenSymbols.USDT]: tokens.USDT.setAddress(optimismCommon.USDT).toObject()}, - {[TokenSymbols.WLD]: tokens.WLD.setAddress(optimismCommon.WLD).toObject()}, - {[TokenSymbols.YIELDBTC]: tokens.YIELDBTC.setAddress(optimismCommon.YIELDBTC).toObject()}, - {[TokenSymbols.YIELDETH]: tokens.YIELDETH.setAddress(optimismCommon.YIELDETH).toObject()}, - {[TokenSymbols.YFI]: tokens.YFI.setAddress(optimismCommon.YFI).toObject()}, - {[TokenSymbols.ZRX]: tokens.ZRX.setAddress(optimismCommon.ZRX).toObject()}, + ...generateEntries(tokens, optimismCommon), ], [Networks.ARBITRUM]: [ - {[TokenSymbols.USDC]: tokens.USDC.setAddress(arbitrumCommon.USDC).toObject()}, - {[TokenSymbols.WETH]: tokens.WETH.setAddress(arbitrumCommon.WETH).toObject()}, - {[TokenSymbols.STETH]: tokens.STETH.setAddress(arbitrumCommon.STETH).toObject()}, - {[TokenSymbols.WSTETH]: tokens.WSTETH.setAddress(arbitrumCommon.WSTETH).toObject()}, - {[TokenSymbols.WBTC]: tokens.WBTC.setAddress(arbitrumCommon.WBTC).toObject()}, - {[TokenSymbols.DAI]: tokens.DAI.setAddress(arbitrumCommon.DAI).toObject()}, - {[TokenSymbols.CBETH]: tokens.CBETH.setAddress(arbitrumCommon.CBETH).toObject()}, - {[TokenSymbols.RETH]: tokens.RETH.setAddress(arbitrumCommon.RETH).toObject()}, - {[TokenSymbols.AAVE]: tokens.AAVE.setAddress(arbitrumCommon.AAVE).toObject()}, - {[TokenSymbols.LINK]: tokens.LINK.setAddress(arbitrumCommon.LINK).toObject()}, - {[TokenSymbols.UNI]: tokens.UNI.setAddress(arbitrumCommon.UNI).toObject()}, - // {[TokenSymbols.SUSHI]: tokens.SUSHI.setAddress(arbitrumCommon.SUSHI).toObject()}, - // {[TokenSymbols.CRV]: tokens.CRV.setAddress(arbitrumCommon.CRV).toObject()}, - // {[TokenSymbols.SNX]: tokens.SNX.setAddress(arbitrumCommon.SNX).toObject()}, - {[TokenSymbols.ADAI]: tokens.ADAI.setAddress(arbitrumCommon.ADAI).toObject()}, - {[TokenSymbols.BAL]: tokens.BAL.setAddress(arbitrumCommon.BAL).toObject()}, - {[TokenSymbols.BAT]: tokens.BAT.setAddress(arbitrumCommon.BAT).toObject()}, - {[TokenSymbols.COMP]: tokens.COMP.setAddress(arbitrumCommon.COMP).toObject()}, - {[TokenSymbols.CRVV1ETHSTETH]: tokens.CRVV1ETHSTETH.setAddress(arbitrumCommon.CRVV1ETHSTETH).toObject()}, - {[TokenSymbols.FRAX]: tokens.FRAX.setAddress(arbitrumCommon.FRAX).toObject()}, - {[TokenSymbols.GHO]: tokens.GHO.setAddress(arbitrumCommon.GHO).toObject()}, - {[TokenSymbols.GUNIV3DAIUSDC1]: tokens.GUNIV3DAIUSDC1.setAddress(arbitrumCommon.GUNIV3DAIUSDC1).toObject()}, - {[TokenSymbols.GUNIV3DAIUSDC2]: tokens.GUNIV3DAIUSDC2.setAddress(arbitrumCommon.GUNIV3DAIUSDC2).toObject()}, - {[TokenSymbols.GUSD]: tokens.GUSD.setAddress(arbitrumCommon.GUSD).toObject()}, - {[TokenSymbols.KNC]: tokens.KNC.setAddress(arbitrumCommon.KNC).toObject()}, - {[TokenSymbols.LDO]: tokens.LRC.setAddress(arbitrumCommon.LDO).toObject()}, - {[TokenSymbols.LRC]: tokens.LRC.setAddress(arbitrumCommon.LRC).toObject()}, - {[TokenSymbols.LUSD]: tokens.LUSD.setAddress(arbitrumCommon.LUSD).toObject()}, - {[TokenSymbols.MANA]: tokens.MANA.setAddress(arbitrumCommon.MANA).toObject()}, - {[TokenSymbols.MATIC]: tokens.MATIC.setAddress(arbitrumCommon.MATIC).toObject()}, - {[TokenSymbols.PAX]: tokens.PAX.setAddress(arbitrumCommon.PAX).toObject()}, - {[TokenSymbols.PAXUSD]: tokens.PAXUSD.setAddress(arbitrumCommon.PAXUSD).toObject()}, - {[TokenSymbols.RENBTC]: tokens.RENBTC.setAddress(arbitrumCommon.RENBTC).toObject()}, - {[TokenSymbols.RWA001]: tokens.RWA001.setAddress(arbitrumCommon.RWA001).toObject()}, - {[TokenSymbols.RWA002]: tokens.RWA002.setAddress(arbitrumCommon.RWA002).toObject()}, - {[TokenSymbols.RWA003]: tokens.RWA003.setAddress(arbitrumCommon.RWA003).toObject()}, - {[TokenSymbols.RWA004]: tokens.RWA004.setAddress(arbitrumCommon.RWA004).toObject()}, - {[TokenSymbols.RWA005]: tokens.RWA005.setAddress(arbitrumCommon.RWA005).toObject()}, - {[TokenSymbols.RWA006]: tokens.RWA006.setAddress(arbitrumCommon.RWA006).toObject()}, - {[TokenSymbols.SDAI]: tokens.SDAI.setAddress(arbitrumCommon.SDAI).toObject()}, - {[TokenSymbols.TBTC]: tokens.TBTC.setAddress(arbitrumCommon.TBTC).toObject()}, - {[TokenSymbols.TUSD]: tokens.TUSD.setAddress(arbitrumCommon.TUSD).toObject()}, - {[TokenSymbols.UNIV2AAVEETH]: tokens.UNIV2AAVEETH.setAddress(arbitrumCommon.UNIV2AAVEETH).toObject()}, - {[TokenSymbols.UNIV2DAIETH]: tokens.UNIV2DAIETH.setAddress(arbitrumCommon.UNIV2DAIETH).toObject()}, - {[TokenSymbols.UNIV2DAIUSDC]: tokens.UNIV2DAIUSDC.setAddress(arbitrumCommon.UNIV2DAIUSDC).toObject()}, - {[TokenSymbols.UNIV2DAIUSDT]: tokens.UNIV2DAIUSDT.setAddress(arbitrumCommon.UNIV2DAIUSDT).toObject()}, - {[TokenSymbols.UNIV2ETHUSDT]: tokens.UNIV2ETHUSDT.setAddress(arbitrumCommon.UNIV2ETHUSDT).toObject()}, - {[TokenSymbols.UNIV2LINKETH]: tokens.UNIV2LINKETH.setAddress(arbitrumCommon.UNIV2LINKETH).toObject()}, - {[TokenSymbols.UNIV2UNIETH]: tokens.UNIV2UNIETH.setAddress(arbitrumCommon.UNIV2UNIETH).toObject()}, - {[TokenSymbols.UNIV2USDCETH]: tokens.UNIV2USDCETH.setAddress(arbitrumCommon.UNIV2USDCETH).toObject()}, - {[TokenSymbols.UNIV2WBTCDAI]: tokens.UNIV2WBTCDAI.setAddress(arbitrumCommon.UNIV2WBTCDAI).toObject()}, - {[TokenSymbols.UNIV2WBTCETH]: tokens.UNIV2WBTCETH.setAddress(arbitrumCommon.UNIV2WBTCETH).toObject()}, - {[TokenSymbols.USDT]: tokens.USDT.setAddress(arbitrumCommon.USDT).toObject()}, - {[TokenSymbols.WLD]: tokens.WLD.setAddress(arbitrumCommon.WLD).toObject()}, - {[TokenSymbols.YIELDBTC]: tokens.YIELDBTC.setAddress(arbitrumCommon.YIELDBTC).toObject()}, - {[TokenSymbols.YIELDETH]: tokens.YIELDETH.setAddress(arbitrumCommon.YIELDETH).toObject()}, - {[TokenSymbols.YFI]: tokens.YFI.setAddress(arbitrumCommon.YFI).toObject()}, - {[TokenSymbols.ZRX]: tokens.ZRX.setAddress(arbitrumCommon.ZRX).toObject()}, + ...generateEntries(tokens, arbitrumCommon), ], [Networks.BASE]: [], [Networks.POLYGON]: [], [Networks.GOERLI]: [ - {[TokenSymbols.USDC]: tokens.USDC.setAddress(goerliCommon.USDC).toObject()}, - {[TokenSymbols.WETH]: tokens.WETH.setAddress(goerliCommon.WETH).toObject()}, - {[TokenSymbols.STETH]: tokens.STETH.setAddress(goerliCommon.STETH).toObject()}, - {[TokenSymbols.WSTETH]: tokens.WSTETH.setAddress(goerliCommon.WSTETH).toObject()}, - {[TokenSymbols.WBTC]: tokens.WBTC.setAddress(goerliCommon.WBTC).toObject()}, - {[TokenSymbols.DAI]: tokens.DAI.setAddress(goerliCommon.DAI).toObject()}, - {[TokenSymbols.CBETH]: tokens.CBETH.setAddress(goerliCommon.CBETH).toObject()}, - {[TokenSymbols.RETH]: tokens.RETH.setAddress(goerliCommon.RETH).toObject()}, - {[TokenSymbols.AAVE]: tokens.AAVE.setAddress(goerliCommon.AAVE).toObject()}, - {[TokenSymbols.LINK]: tokens.LINK.setAddress(goerliCommon.LINK).toObject()}, - {[TokenSymbols.UNI]: tokens.UNI.setAddress(goerliCommon.UNI).toObject()}, - // {[TokenSymbols.SUSHI]: tokens.SUSHI.setAddress(goerliCommon.SUSHI).toObject()}, - // {[TokenSymbols.CRV]: tokens.CRV.setAddress(goerliCommon.CRV).toObject()}, - // {[TokenSymbols.SNX]: tokens.SNX.setAddress(goerliCommon.SNX).toObject()}, - {[TokenSymbols.ADAI]: tokens.ADAI.setAddress(goerliCommon.ADAI).toObject()}, - {[TokenSymbols.BAL]: tokens.BAL.setAddress(goerliCommon.BAL).toObject()}, - {[TokenSymbols.BAT]: tokens.BAT.setAddress(goerliCommon.BAT).toObject()}, - {[TokenSymbols.COMP]: tokens.COMP.setAddress(goerliCommon.COMP).toObject()}, - {[TokenSymbols.CRVV1ETHSTETH]: tokens.CRVV1ETHSTETH.setAddress(goerliCommon.CRVV1ETHSTETH).toObject()}, - {[TokenSymbols.FRAX]: tokens.FRAX.setAddress(goerliCommon.FRAX).toObject()}, - {[TokenSymbols.GHO]: tokens.GHO.setAddress(goerliCommon.GHO).toObject()}, - {[TokenSymbols.GUNIV3DAIUSDC1]: tokens.GUNIV3DAIUSDC1.setAddress(goerliCommon.GUNIV3DAIUSDC1).toObject()}, - {[TokenSymbols.GUNIV3DAIUSDC2]: tokens.GUNIV3DAIUSDC2.setAddress(goerliCommon.GUNIV3DAIUSDC2).toObject()}, - {[TokenSymbols.GUSD]: tokens.GUSD.setAddress(goerliCommon.GUSD).toObject()}, - {[TokenSymbols.KNC]: tokens.KNC.setAddress(goerliCommon.KNC).toObject()}, - {[TokenSymbols.LDO]: tokens.LRC.setAddress(goerliCommon.LDO).toObject()}, - {[TokenSymbols.LRC]: tokens.LRC.setAddress(goerliCommon.LRC).toObject()}, - {[TokenSymbols.LUSD]: tokens.LUSD.setAddress(goerliCommon.LUSD).toObject()}, - {[TokenSymbols.MANA]: tokens.MANA.setAddress(goerliCommon.MANA).toObject()}, - {[TokenSymbols.MATIC]: tokens.MATIC.setAddress(goerliCommon.MATIC).toObject()}, - {[TokenSymbols.PAX]: tokens.PAX.setAddress(goerliCommon.PAX).toObject()}, - {[TokenSymbols.PAXUSD]: tokens.PAXUSD.setAddress(goerliCommon.PAXUSD).toObject()}, - {[TokenSymbols.RENBTC]: tokens.RENBTC.setAddress(goerliCommon.RENBTC).toObject()}, - {[TokenSymbols.RWA001]: tokens.RWA001.setAddress(goerliCommon.RWA001).toObject()}, - {[TokenSymbols.RWA002]: tokens.RWA002.setAddress(goerliCommon.RWA002).toObject()}, - {[TokenSymbols.RWA003]: tokens.RWA003.setAddress(goerliCommon.RWA003).toObject()}, - {[TokenSymbols.RWA004]: tokens.RWA004.setAddress(goerliCommon.RWA004).toObject()}, - {[TokenSymbols.RWA005]: tokens.RWA005.setAddress(goerliCommon.RWA005).toObject()}, - {[TokenSymbols.RWA006]: tokens.RWA006.setAddress(goerliCommon.RWA006).toObject()}, - {[TokenSymbols.SDAI]: tokens.SDAI.setAddress(goerliCommon.SDAI).toObject()}, - {[TokenSymbols.TBTC]: tokens.TBTC.setAddress(goerliCommon.TBTC).toObject()}, - {[TokenSymbols.TUSD]: tokens.TUSD.setAddress(goerliCommon.TUSD).toObject()}, - {[TokenSymbols.UNIV2AAVEETH]: tokens.UNIV2AAVEETH.setAddress(goerliCommon.UNIV2AAVEETH).toObject()}, - {[TokenSymbols.UNIV2DAIETH]: tokens.UNIV2DAIETH.setAddress(goerliCommon.UNIV2DAIETH).toObject()}, - {[TokenSymbols.UNIV2DAIUSDC]: tokens.UNIV2DAIUSDC.setAddress(goerliCommon.UNIV2DAIUSDC).toObject()}, - {[TokenSymbols.UNIV2DAIUSDT]: tokens.UNIV2DAIUSDT.setAddress(goerliCommon.UNIV2DAIUSDT).toObject()}, - {[TokenSymbols.UNIV2ETHUSDT]: tokens.UNIV2ETHUSDT.setAddress(goerliCommon.UNIV2ETHUSDT).toObject()}, - {[TokenSymbols.UNIV2LINKETH]: tokens.UNIV2LINKETH.setAddress(goerliCommon.UNIV2LINKETH).toObject()}, - {[TokenSymbols.UNIV2UNIETH]: tokens.UNIV2UNIETH.setAddress(goerliCommon.UNIV2UNIETH).toObject()}, - {[TokenSymbols.UNIV2USDCETH]: tokens.UNIV2USDCETH.setAddress(goerliCommon.UNIV2USDCETH).toObject()}, - {[TokenSymbols.UNIV2WBTCDAI]: tokens.UNIV2WBTCDAI.setAddress(goerliCommon.UNIV2WBTCDAI).toObject()}, - {[TokenSymbols.UNIV2WBTCETH]: tokens.UNIV2WBTCETH.setAddress(goerliCommon.UNIV2WBTCETH).toObject()}, - {[TokenSymbols.USDT]: tokens.USDT.setAddress(goerliCommon.USDT).toObject()}, - {[TokenSymbols.WLD]: tokens.WLD.setAddress(goerliCommon.WLD).toObject()}, - {[TokenSymbols.YIELDBTC]: tokens.YIELDBTC.setAddress(goerliCommon.YIELDBTC).toObject()}, - {[TokenSymbols.YIELDETH]: tokens.YIELDETH.setAddress(goerliCommon.YIELDETH).toObject()}, - {[TokenSymbols.YFI]: tokens.YFI.setAddress(goerliCommon.YFI).toObject()}, - {[TokenSymbols.ZRX]: tokens.ZRX.setAddress(goerliCommon.ZRX).toObject()}, + ...generateEntries(tokens, goerliCommon), ], [Networks.OPTIMISM_GOERLI]: [], [Networks.ARBITRUM_GOERLI]: [], [Networks.POLYGON_MUMBAI]: [], } -}; \ No newline at end of file +}; + +function generateEntries(tokens: Tokens, networkCommonAddresses: Record) { + const entries = []; + + for (const tokenSymbol in tokens) { + // We're forcing the type here because we know that the tokenSymbol is (or should be) a key of Tokens + const address = networkCommonAddresses[tokenSymbol as keyof typeof networkCommonAddresses]; + + // Check if the address is neither ZERO_ADDRESS nor an empty string. + // Also in case there's no overlap between tokenSymbols and networkCommonAddresses ignore the tokenSymbol + if (address && address !== "" && address !== ADDRESS_ZERO) { + const tokenObject = { + [tokenSymbol]: tokens[tokenSymbol as TokenSymbols].setAddress(address).toObject() + }; + entries.push(tokenObject); + } + } + + return entries +} \ No newline at end of file diff --git a/helpers/constants.ts b/helpers/constants.ts index 145d682..ea5a794 100644 --- a/helpers/constants.ts +++ b/helpers/constants.ts @@ -10,3 +10,5 @@ export const constants = { configFolder: path.join(__dirname, "../configs"), distFolder: path.join(__dirname, "../dist"), }; + + diff --git a/helpers/index.ts b/helpers/index.ts index 8a220c1..bddca7d 100644 --- a/helpers/index.ts +++ b/helpers/index.ts @@ -1,7 +1,7 @@ -export { constants } from "./constants"; -export { generateConfigs } from "./generate-configs"; -export { getConfigMainModules } from "./get-config-main-modules"; -export { getEnvironments } from "./get-environments"; -export { parseConfig } from "./parse-config"; -export { createConfigFiles } from "./create-config-files"; +export {constants} from "./constants"; +export {generateConfigs} from "./generate-configs"; +export {getConfigMainModules} from "./get-config-main-modules"; +export {getEnvironments} from "./get-environments"; +export {parseConfig} from "./parse-config"; +export {createConfigFiles} from "./create-config-files"; export * from './enum-to-object' \ No newline at end of file From 54f71dd61b9390997677bcd3d7158ff3e2e65209 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Fri, 13 Oct 2023 10:05:28 +0100 Subject: [PATCH 12/17] chore: bump addresses --- bun.lockb | Bin 82743 -> 82743 bytes package.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/bun.lockb b/bun.lockb index 313146d137e1cc1b1ee596cb9f4ce69432ad27a8..8178e3f28c6492e2e3291269aa3ee46e1b7c6601 100755 GIT binary patch delta 235 zcmdnq#=5WM#=R*@xdGfh`)GdQ_|;}qZIUzzr1EBM#m+3pp}njc&v$aQ0n zLD}95+q~DTFKnxre2`CAQ~_uc3)Er|4RVFeX5M)VT^Y?cuYdeHj@4YRB)tk~tN!E* LLJDx4z|RQ)u5(yA delta 240 zcmdnq#=5N7nDjUvWbdI?n@#Qz*Oko3B>gH>D zH=jo-Tdlh5qKib1K(^r3(??Eb?>ZW`c&d-=$JjgBJ$D2S&k|@|zU%szO@XQ|R_yaT zykpNT3|jOVVG{$g)htkP5DjvU^=96A3tbsaH?M#EI*!#;uOz){a-*33 Date: Fri, 13 Oct 2023 15:00:12 +0100 Subject: [PATCH 13/17] fix: address Piter review points --- configs/domain/get-denomination-symbols.ts | 6 +- configs/domain/get-lending-protocols.ts | 6 +- configs/domain/get-networks.ts | 6 +- configs/domain/get-tokens-by-network.ts | 34 ++--- configs/domain/get-tokens-by-token-symbol.ts | 14 ++ configs/domain/get-tokens.ts | 14 -- configs/domain/index.ts | 4 +- configs/oasis-borrow/getNavigation.ts | 6 +- configs/oasis-borrow/getParameters.ts | 4 +- shared/denomination-symbol.ts | 26 ++++ shared/denomination-symbols.ts | 22 --- shared/index.ts | 8 +- shared/lending-protocol.ts | 23 +++ shared/lending-protocols.ts | 15 -- shared/network.ts | 19 +++ shared/networks.ts | 14 -- shared/token-symbol.ts | 70 +++++++++ shared/token-symbols.ts | 62 -------- shared/tokens.ts | 148 ++++++++++--------- 19 files changed, 270 insertions(+), 231 deletions(-) create mode 100644 configs/domain/get-tokens-by-token-symbol.ts delete mode 100644 configs/domain/get-tokens.ts create mode 100644 shared/denomination-symbol.ts delete mode 100644 shared/denomination-symbols.ts create mode 100644 shared/lending-protocol.ts delete mode 100644 shared/lending-protocols.ts create mode 100644 shared/network.ts delete mode 100644 shared/networks.ts create mode 100644 shared/token-symbol.ts delete mode 100644 shared/token-symbols.ts diff --git a/configs/domain/get-denomination-symbols.ts b/configs/domain/get-denomination-symbols.ts index 0d37679..cc250ef 100644 --- a/configs/domain/get-denomination-symbols.ts +++ b/configs/domain/get-denomination-symbols.ts @@ -1,6 +1,6 @@ -import {DenominationSymbols} from "🤝"; +import {DenominationSymbol} from "🤝"; import {EnumToObject, enumToObject} from "🛠️"; -export const getDenominationSymbols = (): EnumToObject => { - return enumToObject(DenominationSymbols) +export const getDenominationSymbols = (): EnumToObject => { + return enumToObject(DenominationSymbol) }; \ No newline at end of file diff --git a/configs/domain/get-lending-protocols.ts b/configs/domain/get-lending-protocols.ts index ef320db..f9906a8 100644 --- a/configs/domain/get-lending-protocols.ts +++ b/configs/domain/get-lending-protocols.ts @@ -1,6 +1,8 @@ -import { LendingProtocol, LendingProtocolLabel} from "🤝"; +import { LendingProtocol, LendingProtocolLabel } from "🤝"; -export const getLendingProtocols = (): Record => { +type LendingProtocolLabelValueType = typeof LendingProtocolLabel[keyof typeof LendingProtocolLabel]; + +export const getLendingProtocols = (): Record => { return { [LendingProtocol.AaveV2]: LendingProtocolLabel.aavev2, [LendingProtocol.AaveV3]: LendingProtocolLabel.aavev3, diff --git a/configs/domain/get-networks.ts b/configs/domain/get-networks.ts index ea04526..4848162 100644 --- a/configs/domain/get-networks.ts +++ b/configs/domain/get-networks.ts @@ -1,6 +1,6 @@ import {EnumToObject, enumToObject} from "🛠️"; -import {Networks} from "🤝"; +import {Network} from "🤝"; -export const getNetworks = (): EnumToObject => { - return enumToObject(Networks) +export const getNetworks = (): EnumToObject => { + return enumToObject(Network) }; \ No newline at end of file diff --git a/configs/domain/get-tokens-by-network.ts b/configs/domain/get-tokens-by-network.ts index 094a92a..4740b65 100644 --- a/configs/domain/get-tokens-by-network.ts +++ b/configs/domain/get-tokens-by-network.ts @@ -1,12 +1,12 @@ import {ADDRESSES, ADDRESS_ZERO, Common, SystemKeys} from '@oasisdex/addresses' -import {IToken, Networks, TokenSymbols, Tokens, tokens} from "🤝"; +import {IToken, Network, TokenSymbol, Tokens, tokens} from "🤝"; type TokenSubset = { - [key in TokenSymbols]?: IToken; + [key in TokenSymbol]?: IToken; }; type NetworkTokens = { - [network in Networks]: TokenSubset[]; + [network in Network]: TokenSubset[]; }; /** @@ -14,32 +14,32 @@ type NetworkTokens = { * Can be enhanced to return address enriched tokens for each network */ export const getTokensByNetwork = (): NetworkTokens => { - const mainnetCommon = ADDRESSES[Networks.MAINNET][SystemKeys.COMMON] - const optimismCommon = ADDRESSES[Networks.OPTIMISM][SystemKeys.COMMON] - const arbitrumCommon = ADDRESSES[Networks.ARBITRUM][SystemKeys.COMMON] + const mainnetCommon = ADDRESSES[Network.MAINNET][SystemKeys.COMMON] + const optimismCommon = ADDRESSES[Network.OPTIMISM][SystemKeys.COMMON] + const arbitrumCommon = ADDRESSES[Network.ARBITRUM][SystemKeys.COMMON] // const baseCommon = ADDRESSES[Networks.BASE][SystemKeys.COMMON] // const polygonCommon = ADDRESSES[Networks.POLYGON][SystemKeys.COMMON] - const goerliCommon = ADDRESSES[Networks.GOERLI][SystemKeys.COMMON] + const goerliCommon = ADDRESSES[Network.GOERLI][SystemKeys.COMMON] // const optimismGoerliCommon = ADDRESSES[Networks.OPTIMISM_GOERLI][SystemKeys.COMMON] return { - [Networks.MAINNET]: [ + [Network.MAINNET]: [ ...generateEntries(tokens, mainnetCommon) ], - [Networks.OPTIMISM]: [ + [Network.OPTIMISM]: [ ...generateEntries(tokens, optimismCommon), ], - [Networks.ARBITRUM]: [ + [Network.ARBITRUM]: [ ...generateEntries(tokens, arbitrumCommon), ], - [Networks.BASE]: [], - [Networks.POLYGON]: [], - [Networks.GOERLI]: [ + [Network.BASE]: [], + [Network.POLYGON]: [], + [Network.GOERLI]: [ ...generateEntries(tokens, goerliCommon), ], - [Networks.OPTIMISM_GOERLI]: [], - [Networks.ARBITRUM_GOERLI]: [], - [Networks.POLYGON_MUMBAI]: [], + [Network.OPTIMISM_GOERLI]: [], + [Network.ARBITRUM_GOERLI]: [], + [Network.POLYGON_MUMBAI]: [], } }; @@ -54,7 +54,7 @@ function generateEntries(tokens: Tokens, networkCommonAddresses: Record> => { + const result: Record> = {} as unknown as Record>; + + for (const symbol of Object.keys(tokensByTokenSymbol) as TokenSymbol[]) { + if (Object.prototype.hasOwnProperty.call(tokensByTokenSymbol, symbol) && tokensByTokenSymbol[symbol].toObject) { + result[symbol] = { ...tokensByTokenSymbol[symbol].toObject() }; + } + } + + return result; +}; \ No newline at end of file diff --git a/configs/domain/get-tokens.ts b/configs/domain/get-tokens.ts deleted file mode 100644 index d4119d7..0000000 --- a/configs/domain/get-tokens.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {IToken, TokenSymbols, tokens} from "🤝"; - - -export const getTokens = (): Record> => { - const result: Record> = {} as unknown as Record>; - - for (const symbol of Object.keys(tokens) as TokenSymbols[]) { - if (Object.prototype.hasOwnProperty.call(tokens, symbol) && tokens[symbol].toObject) { - result[symbol] = { ...tokens[symbol].toObject() }; - } - } - - return result; -}; \ No newline at end of file diff --git a/configs/domain/index.ts b/configs/domain/index.ts index a89ef7f..5a9dd85 100644 --- a/configs/domain/index.ts +++ b/configs/domain/index.ts @@ -1,8 +1,8 @@ import {getDenominationSymbols} from "./get-denomination-symbols"; import {getLendingProtocols} from "./get-lending-protocols"; import {getNetworks} from "./get-networks"; -import {getTokens} from "./get-tokens"; import {getTokensByNetwork} from "./get-tokens-by-network"; +import {getTokensByTokenSymbol} from "./get-tokens-by-token-symbol"; export default function () { /** @@ -12,7 +12,7 @@ export default function () { * Possible extensions could include Products / Product categories / Strategies etc */ return { - tokens: getTokens(), + tokens: getTokensByTokenSymbol(), tokensByNetwork: getTokensByNetwork(), lendingProtocols: getLendingProtocols(), networks: getNetworks(), diff --git a/configs/oasis-borrow/getNavigation.ts b/configs/oasis-borrow/getNavigation.ts index ad75535..e055fb9 100644 --- a/configs/oasis-borrow/getNavigation.ts +++ b/configs/oasis-borrow/getNavigation.ts @@ -1,4 +1,4 @@ -import {TokenSymbols} from "🤝"; +import {TokenSymbol} from "🤝"; export const getNavigation= () => ({ protocols: { @@ -72,7 +72,7 @@ export const getNavigation= () => ({ }, }, tokens: { - popular: [TokenSymbols.ETH, TokenSymbols.STETH, TokenSymbols.RETH, TokenSymbols.CBETH, TokenSymbols.DAI, TokenSymbols.WBTC, TokenSymbols.USDC], - new: [TokenSymbols.SDAI], + popular: [TokenSymbol.ETH, TokenSymbol.STETH, TokenSymbol.RETH, TokenSymbol.CBETH, TokenSymbol.DAI, TokenSymbol.WBTC, TokenSymbol.USDC], + new: [TokenSymbol.SDAI], }, }) \ No newline at end of file diff --git a/configs/oasis-borrow/getParameters.ts b/configs/oasis-borrow/getParameters.ts index 236848e..965f572 100644 --- a/configs/oasis-borrow/getParameters.ts +++ b/configs/oasis-borrow/getParameters.ts @@ -1,5 +1,5 @@ import { ConfigHelperType } from "⌨️"; -import {TokenSymbols} from "🤝"; +import {TokenSymbol} from "🤝"; export const getParameters = ({ notProduction, @@ -14,7 +14,7 @@ export const getParameters = ({ showFlashloanInformation: notProduction, }, closeDisabledFor: { - collateral: [TokenSymbols.DAI, TokenSymbols.USDC], + collateral: [TokenSymbol.DAI, TokenSymbol.USDC], strategyTypes: ["short"], }, adjustDisabledFor: { diff --git a/shared/denomination-symbol.ts b/shared/denomination-symbol.ts new file mode 100644 index 0000000..5668482 --- /dev/null +++ b/shared/denomination-symbol.ts @@ -0,0 +1,26 @@ +/** + * Enum representing popular currency denominations. + * This provides a standardized way to reference these denominations throughout the application. + */ +export enum DenominationSymbol { + USD = 'USD', // United States Dollar + ETH = 'ETH', // Ethereum + BTC = 'BTC', // Bitcoin + GBP = 'GBP', // British Pound Sterling + EUR = 'EUR', // Euro + JPY = 'JPY', // Japanese Yen + KRW = 'KRW', // South Korean Won + CNY = 'CNY', // Chinese Yuan + AUD = 'AUD', // Australian Dollar + CAD = 'CAD', // Canadian Dollar + CHF = 'CHF', // Swiss Franc + ARS = 'ARS', // Argentine Peso + PHP = 'PHP', // Philippine Peso + NZD = 'NZD', // New Zealand Dollar + SGD = 'SGD', // Singapore Dollar + NGN = 'NGN', // Nigerian Naira + ZAR = 'ZAR', // South African Rand + RUB = 'RUB', // Russian Ruble + INR = 'INR', // Indian Rupee + BRL = 'BRL' // Brazilian Real +} diff --git a/shared/denomination-symbols.ts b/shared/denomination-symbols.ts deleted file mode 100644 index 8c23efa..0000000 --- a/shared/denomination-symbols.ts +++ /dev/null @@ -1,22 +0,0 @@ -export enum DenominationSymbols { - USD = 'USD', - ETH = 'ETH', - BTC = 'BTC', - GBP = 'GBP', - EUR = 'EUR', - JPY = 'JPY', - KRW = 'KRW', - CNY = 'CNY', - AUD = 'AUD', - CAD = 'CAD', - CHF = 'CHF', - ARS = 'ARS', - PHP = 'PHP', - NZD = 'NZD', - SGD = 'SGD', - NGN = 'NGN', - ZAR = 'ZAR', - RUB = 'RUB', - INR = 'INR', - BRL = 'BRL' -} diff --git a/shared/index.ts b/shared/index.ts index 6e86f57..e9a1821 100644 --- a/shared/index.ts +++ b/shared/index.ts @@ -1,5 +1,5 @@ -export * from './networks'; -export * from './token-symbols' -export * from './denomination-symbols' +export * from './network'; +export * from './token-symbol' +export * from './denomination-symbol' export * from './tokens'; -export * from './lending-protocols' \ No newline at end of file +export * from './lending-protocol' \ No newline at end of file diff --git a/shared/lending-protocol.ts b/shared/lending-protocol.ts new file mode 100644 index 0000000..ab5ef4d --- /dev/null +++ b/shared/lending-protocol.ts @@ -0,0 +1,23 @@ +/** + * Enum representing various lending protocols supported by the platform. + * This provides a standardized way to reference these protocols throughout the application. + */ +export enum LendingProtocol { + AaveV2 = 'aavev2', // Aave Version 2 + AaveV3 = 'aavev3', // Aave Version 3 + Ajna = 'ajna', // Ajna Protocol + Maker = 'maker', // MakerDAO + SparkV3 = 'sparkv3', // Spark Version 3 +} + +/** + * Object mapping lending protocols to their human-readable labels. + * This can be used for display purposes in UI components. + */ +export const LendingProtocolLabel = { + [LendingProtocol.AaveV2]: 'Aave V2', + [LendingProtocol.AaveV3]: 'Aave V3', + [LendingProtocol.Ajna]: 'Ajna', + [LendingProtocol.Maker]: 'Maker', + [LendingProtocol.SparkV3]: 'Spark', +} diff --git a/shared/lending-protocols.ts b/shared/lending-protocols.ts deleted file mode 100644 index 04decc4..0000000 --- a/shared/lending-protocols.ts +++ /dev/null @@ -1,15 +0,0 @@ -export enum LendingProtocol { - AaveV2 = 'aavev2', - AaveV3 = 'aavev3', - Ajna = 'ajna', - Maker = 'maker', - SparkV3 = 'sparkv3', -} - -export enum LendingProtocolLabel { - aavev2 = 'Aave V2', - aavev3 = 'Aave V3', - ajna = 'Ajna', - maker = 'Maker', - sparkv3 = 'Spark', -} \ No newline at end of file diff --git a/shared/network.ts b/shared/network.ts new file mode 100644 index 0000000..f6381b6 --- /dev/null +++ b/shared/network.ts @@ -0,0 +1,19 @@ +/** + * Enum representing various blockchain networks supported by the platform. + * This includes both mainnets and testnets, providing a standardised way + * to reference these networks throughout the application. + */ +export enum Network { + // Mainnets + MAINNET = 'mainnet', // Ethereum Mainnet + OPTIMISM = 'optimism', // Optimism Layer 2 Mainnet + ARBITRUM = 'arbitrum', // Arbitrum Layer 2 Mainnet + BASE = 'base', // Base Layer 2 Mainnet (Coinbase) + POLYGON = 'polygon', // Polygon (previously Matic) Mainnet + + // Testnets + GOERLI = 'goerli', // Ethereum Goerli Testnet + OPTIMISM_GOERLI = 'optimism_goerli', // Optimism Layer 2 on Goerli Testnet + ARBITRUM_GOERLI = 'arbitrum_goerli', // Arbitrum Layer 2 on Goerli Testnet + POLYGON_MUMBAI = 'polygon_mumbai', // Polygon Mumbai Testnet +} diff --git a/shared/networks.ts b/shared/networks.ts deleted file mode 100644 index a9dbb59..0000000 --- a/shared/networks.ts +++ /dev/null @@ -1,14 +0,0 @@ -export enum Networks { - // Mainnets - MAINNET = 'mainnet', - OPTIMISM = 'optimism', - ARBITRUM = 'arbitrum', - BASE = 'base', - POLYGON = 'polygon', - - // Testnets - GOERLI = 'goerli', - OPTIMISM_GOERLI = 'optimism_goerli', - ARBITRUM_GOERLI = 'arbitrum_goerli', - POLYGON_MUMBAI = 'polygon_mumbai', -} \ No newline at end of file diff --git a/shared/token-symbol.ts b/shared/token-symbol.ts new file mode 100644 index 0000000..1b92122 --- /dev/null +++ b/shared/token-symbol.ts @@ -0,0 +1,70 @@ +/** + * Enum representing various token symbols supported by the platform. + * This provides a standardized way to reference these tokens throughout the application. + */ +export enum TokenSymbol { + ETH = 'ETH', // Ethereum + WETH = 'WETH', // Wrapped Ethereum + STETH = 'STETH', // stakedETH + WSTETH = 'WSTETH', // Wrapped stakedETH + WBTC = 'WBTC', // Wrapped Bitcoin + USDC = 'USDC', // USD Coin + DAI = 'DAI', // Dai Stablecoin + CBETH = 'CBETH', // Compound ETH (assuming, provide accurate description if different) + RETH = 'RETH', // Rocket Pool ETH + AAVE = 'AAVE', + LINK = 'LINK', + UNI = 'UNI', + SUSHI = 'SUSHI', + CRV = 'CRV', + SNX = 'SNX', + ADAI = 'ADAI', // Aave interest bearing DAI + BAL = 'BAL', + BAT = 'BAT', + COMP = 'COMP', + CRVV1ETHSTETH = 'CRVV1ETHSTETH', // Specific Curve pool token + FRAX = 'FRAX', + GHO = 'GHO', + GNO = 'GNO', + GUNIV3DAIUSDC1 = 'GUNIV3DAIUSDC1', // Gelato Uniswap V3 DAI-USDC pool token variant 1 + GUNIV3DAIUSDC2 = 'GUNIV3DAIUSDC2', // Gelato Uniswap V3 DAI-USDC pool token variant 2 + GUSD = 'GUSD', // Gemini Dollar + KNC = 'KNC', // Kyber Network Crystal + LDO = 'LDO', // Lido DAO Token + LRC = 'LRC', // Loopring + LUSD = 'LUSD', // Liquity USD Stablecoin + MANA = 'MANA', // Decentraland + MATIC = 'MATIC', // Polygon token (previously Matic) + PAX = 'PAX', // Paxos Standard + PAXUSD = 'PAXUSD', // Paxos Standard Dollar + RENBTC = 'RENBTC', // Ren Bitcoin + RWA001 = 'RWA001', // Real-World Asset 001 (Maker) + RWA002 = 'RWA002', + RWA003 = 'RWA003', + RWA004 = 'RWA004', + RWA005 = 'RWA005', + RWA006 = 'RWA006', + SDAI = 'SDAI', // Some specific version of DAI + TBTC = 'TBTC', // tBTC (tokenized Bitcoin on Ethereum) + TUSD = 'TUSD', // TrueUSD + UNIV2AAVEETH = 'UNIV2AAVEETH', // Uniswap V2 AAVE-ETH Liquidity Pool Token + UNIV2DAIETH = 'UNIV2DAIETH', // Uniswap V2 DAI-ETH Liquidity Pool Token + UNIV2DAIUSDC = 'UNIV2DAIUSDC', + UNIV2DAIUSDT = 'UNIV2DAIUSDT', + UNIV2ETHUSDT = 'UNIV2ETHUSDT', + UNIV2LINKETH = 'UNIV2LINKETH', + UNIV2UNIETH = 'UNIV2UNIETH', + UNIV2USDCETH = 'UNIV2USDCETH', + UNIV2WBTCDAI = 'UNIV2WBTCDAI', + UNIV2WBTCETH = 'UNIV2WBTCETH', + USDT = 'USDT', // Tether + WLD = 'WLD', + YIELDBTC = 'YIELDBTC', // Yield instrument for BTC + YIELDETH = 'YIELDETH', // Yield instrument for ETH + YFI = 'YFI', // yearn.finance + ZRX = 'ZRX', // 0x +} + + + + diff --git a/shared/token-symbols.ts b/shared/token-symbols.ts deleted file mode 100644 index d4b7802..0000000 --- a/shared/token-symbols.ts +++ /dev/null @@ -1,62 +0,0 @@ -export enum TokenSymbols { - ETH = 'ETH', - WETH = 'WETH', - STETH = 'STETH', - WSTETH = 'WSTETH', - WBTC = 'WBTC', - USDC = 'USDC', - DAI = 'DAI', - CBETH = 'CBETH', - RETH = 'RETH', - AAVE = 'AAVE', - LINK = 'LINK', - UNI = 'UNI', - SUSHI = 'SUSHI', - CRV = 'CRV', - SNX = 'SNX', - ADAI = 'ADAI', - BAL = 'BAL', - BAT = 'BAT', - COMP = 'COMP', - CRVV1ETHSTETH = 'CRVV1ETHSTETH', - FRAX = 'FRAX', - GHO = 'GHO', - GNO = 'GNO', - GUNIV3DAIUSDC1 = 'GUNIV3DAIUSDC1', - GUNIV3DAIUSDC2 = 'GUNIV3DAIUSDC2', - GUSD = 'GUSD', - KNC = 'KNC', - LDO = 'LDO', - LRC = 'LRC', - LUSD = 'LUSD', - MANA = 'MANA', - MATIC = 'MATIC', - PAX = 'PAX', - PAXUSD = 'PAXUSD', - RENBTC = 'RENBTC', - RWA001 = 'RWA001', - RWA002 = 'RWA002', - RWA003 = 'RWA003', - RWA004 = 'RWA004', - RWA005 = 'RWA005', - RWA006 = 'RWA006', - SDAI = 'SDAI', - TBTC = 'TBTC', - TUSD = 'TUSD', - UNIV2AAVEETH = 'UNIV2AAVEETH', - UNIV2DAIETH = 'UNIV2DAIETH', - UNIV2DAIUSDC = 'UNIV2DAIUSDC', - UNIV2DAIUSDT = 'UNIV2DAIUSDT', - UNIV2ETHUSDT = 'UNIV2ETHUSDT', - UNIV2LINKETH = 'UNIV2LINKETH', - UNIV2UNIETH = 'UNIV2UNIETH', - UNIV2USDCETH = 'UNIV2USDCETH', - UNIV2WBTCDAI = 'UNIV2WBTCDAI', - UNIV2WBTCETH = 'UNIV2WBTCETH', - USDT = 'USDT', - WLD = 'WLD', - YIELDBTC = 'YIELDBTC', - YIELDETH = 'YIELDETH', - YFI = 'YFI', - ZRX = 'ZRX', -} \ No newline at end of file diff --git a/shared/tokens.ts b/shared/tokens.ts index b6fe397..48bcbe6 100644 --- a/shared/tokens.ts +++ b/shared/tokens.ts @@ -1,17 +1,24 @@ -import {TokenSymbols} from "./token-symbols"; +/** + * Represents individual tokens with their specific attributes. + * The `Token` class encapsulates details like token symbol, precision (for decimal representation), + * and an optional Ethereum address (if assigned). Additionally, the `tokensByTokenSymbol` dictionary + * allows for easy retrieval of tokens based on their symbol. + */ + +import {TokenSymbol} from "./token-symbol"; export interface IToken { - symbol: TokenSymbols + symbol: TokenSymbol precision: number address?: string } export class Token implements IToken { - symbol: TokenSymbols + symbol: TokenSymbol precision: number address: string - constructor(symbol: TokenSymbols, precision: number, address?: string) { + constructor(symbol: TokenSymbol, precision: number, address?: string) { this.symbol = symbol this.precision = precision this.address = address @@ -23,7 +30,7 @@ export class Token implements IToken { return this } - toObject(): { symbol: TokenSymbols; precision: number, address?: string } { + toObject(): { symbol: TokenSymbol; precision: number, address?: string } { return { symbol: this.symbol, precision: this.precision, @@ -32,72 +39,77 @@ export class Token implements IToken { } } -const ETH = new Token(TokenSymbols.ETH, 18) -const WETH = new Token(TokenSymbols.WETH, 18) -const STETH = new Token(TokenSymbols.STETH, 18) -const WSTETH = new Token(TokenSymbols.WSTETH, 18) -const WBTC = new Token(TokenSymbols.WBTC, 8) -const USDC = new Token(TokenSymbols.USDC, 6) -const DAI = new Token(TokenSymbols.DAI, 18) -const CBETH = new Token(TokenSymbols.CBETH, 8) -const RETH = new Token(TokenSymbols.RETH, 8) -const AAVE = new Token(TokenSymbols.AAVE, 18) -const LINK = new Token(TokenSymbols.LINK, 18) -const UNI = new Token(TokenSymbols.UNI, 18) -const SUSHI = new Token(TokenSymbols.SUSHI, 18) -const CRV = new Token(TokenSymbols.CRV, 18) -const SNX = new Token(TokenSymbols.SNX, 18) -const ADAI = new Token(TokenSymbols.ADAI, 18) -const BAL = new Token(TokenSymbols.BAL, 18) -const BAT = new Token(TokenSymbols.BAT, 18) -const COMP = new Token(TokenSymbols.COMP, 18) -const CRVV1ETHSTETH = new Token(TokenSymbols.CRVV1ETHSTETH, 18) -const FRAX = new Token(TokenSymbols.FRAX, 18) -const GHO = new Token(TokenSymbols.GHO, 18) -const GNO = new Token(TokenSymbols.GNO, 18) -const GUNIV3DAIUSDC1 = new Token(TokenSymbols.GUNIV3DAIUSDC1, 18) -const GUNIV3DAIUSDC2 = new Token(TokenSymbols.GUNIV3DAIUSDC2, 18) -const GUSD = new Token(TokenSymbols.GUSD, 2) -const KNC = new Token(TokenSymbols.KNC, 18) -const LDO = new Token(TokenSymbols.LDO, 18) -const LRC = new Token(TokenSymbols.LRC, 18) -const LUSD = new Token(TokenSymbols.LUSD, 18) -const MANA = new Token(TokenSymbols.MANA, 18) -const MATIC = new Token(TokenSymbols.MATIC, 18) -const PAX = new Token(TokenSymbols.PAX, 18) -const PAXUSD = new Token(TokenSymbols.PAXUSD, 18) -const RENBTC = new Token(TokenSymbols.RENBTC, 8) -const RWA001 = new Token(TokenSymbols.RWA001, 18) -const RWA002 = new Token(TokenSymbols.RWA002, 18) -const RWA003 = new Token(TokenSymbols.RWA003, 18) -const RWA004 = new Token(TokenSymbols.RWA004, 18) -const RWA005 = new Token(TokenSymbols.RWA005, 18) -const RWA006 = new Token(TokenSymbols.RWA006, 18) -const SDAI = new Token(TokenSymbols.SDAI, 18) -const TBTC = new Token(TokenSymbols.TBTC, 18) -const TUSD = new Token(TokenSymbols.TUSD, 18) -const UNIV2AAVEETH = new Token(TokenSymbols.UNIV2AAVEETH, 18) -const UNIV2DAIETH = new Token(TokenSymbols.UNIV2DAIETH, 18) -const UNIV2DAIUSDC = new Token(TokenSymbols.UNIV2DAIUSDC, 18) -const UNIV2DAIUSDT = new Token(TokenSymbols.UNIV2DAIUSDT, 18) -const UNIV2ETHUSDT = new Token(TokenSymbols.UNIV2ETHUSDT, 18) -const UNIV2LINKETH = new Token(TokenSymbols.UNIV2LINKETH, 18) -const UNIV2UNIETH = new Token(TokenSymbols.UNIV2UNIETH, 18) -const UNIV2USDCETH = new Token(TokenSymbols.UNIV2USDCETH, 18) -const UNIV2WBTCDAI = new Token(TokenSymbols.UNIV2WBTCDAI, 18) -const UNIV2WBTCETH = new Token(TokenSymbols.UNIV2WBTCETH, 18) -const USDT = new Token(TokenSymbols.USDT, 6) -const WLD = new Token(TokenSymbols.WLD, 8) -const YIELDBTC = new Token(TokenSymbols.YIELDBTC, 8) -const YIELDETH = new Token(TokenSymbols.YIELDETH, 18) -const YFI = new Token(TokenSymbols.YFI, 18) -const ZRX = new Token(TokenSymbols.ZRX, 18) +const ETH = new Token(TokenSymbol.ETH, 18) +const WETH = new Token(TokenSymbol.WETH, 18) +const STETH = new Token(TokenSymbol.STETH, 18) +const WSTETH = new Token(TokenSymbol.WSTETH, 18) +const WBTC = new Token(TokenSymbol.WBTC, 8) +const USDC = new Token(TokenSymbol.USDC, 6) +const DAI = new Token(TokenSymbol.DAI, 18) +const CBETH = new Token(TokenSymbol.CBETH, 8) +const RETH = new Token(TokenSymbol.RETH, 8) +const AAVE = new Token(TokenSymbol.AAVE, 18) +const LINK = new Token(TokenSymbol.LINK, 18) +const UNI = new Token(TokenSymbol.UNI, 18) +const SUSHI = new Token(TokenSymbol.SUSHI, 18) +const CRV = new Token(TokenSymbol.CRV, 18) +const SNX = new Token(TokenSymbol.SNX, 18) +const ADAI = new Token(TokenSymbol.ADAI, 18) +const BAL = new Token(TokenSymbol.BAL, 18) +const BAT = new Token(TokenSymbol.BAT, 18) +const COMP = new Token(TokenSymbol.COMP, 18) +const CRVV1ETHSTETH = new Token(TokenSymbol.CRVV1ETHSTETH, 18) +const FRAX = new Token(TokenSymbol.FRAX, 18) +const GHO = new Token(TokenSymbol.GHO, 18) +const GNO = new Token(TokenSymbol.GNO, 18) +const GUNIV3DAIUSDC1 = new Token(TokenSymbol.GUNIV3DAIUSDC1, 18) +const GUNIV3DAIUSDC2 = new Token(TokenSymbol.GUNIV3DAIUSDC2, 18) +const GUSD = new Token(TokenSymbol.GUSD, 2) +const KNC = new Token(TokenSymbol.KNC, 18) +const LDO = new Token(TokenSymbol.LDO, 18) +const LRC = new Token(TokenSymbol.LRC, 18) +const LUSD = new Token(TokenSymbol.LUSD, 18) +const MANA = new Token(TokenSymbol.MANA, 18) +const MATIC = new Token(TokenSymbol.MATIC, 18) +const PAX = new Token(TokenSymbol.PAX, 18) +const PAXUSD = new Token(TokenSymbol.PAXUSD, 18) +const RENBTC = new Token(TokenSymbol.RENBTC, 8) +const RWA001 = new Token(TokenSymbol.RWA001, 18) +const RWA002 = new Token(TokenSymbol.RWA002, 18) +const RWA003 = new Token(TokenSymbol.RWA003, 18) +const RWA004 = new Token(TokenSymbol.RWA004, 18) +const RWA005 = new Token(TokenSymbol.RWA005, 18) +const RWA006 = new Token(TokenSymbol.RWA006, 18) +const SDAI = new Token(TokenSymbol.SDAI, 18) +const TBTC = new Token(TokenSymbol.TBTC, 18) +const TUSD = new Token(TokenSymbol.TUSD, 18) +const UNIV2AAVEETH = new Token(TokenSymbol.UNIV2AAVEETH, 18) +const UNIV2DAIETH = new Token(TokenSymbol.UNIV2DAIETH, 18) +const UNIV2DAIUSDC = new Token(TokenSymbol.UNIV2DAIUSDC, 18) +const UNIV2DAIUSDT = new Token(TokenSymbol.UNIV2DAIUSDT, 18) +const UNIV2ETHUSDT = new Token(TokenSymbol.UNIV2ETHUSDT, 18) +const UNIV2LINKETH = new Token(TokenSymbol.UNIV2LINKETH, 18) +const UNIV2UNIETH = new Token(TokenSymbol.UNIV2UNIETH, 18) +const UNIV2USDCETH = new Token(TokenSymbol.UNIV2USDCETH, 18) +const UNIV2WBTCDAI = new Token(TokenSymbol.UNIV2WBTCDAI, 18) +const UNIV2WBTCETH = new Token(TokenSymbol.UNIV2WBTCETH, 18) +const USDT = new Token(TokenSymbol.USDT, 6) +const WLD = new Token(TokenSymbol.WLD, 8) +const YIELDBTC = new Token(TokenSymbol.YIELDBTC, 8) +const YIELDETH = new Token(TokenSymbol.YIELDETH, 18) +const YFI = new Token(TokenSymbol.YFI, 18) +const ZRX = new Token(TokenSymbol.ZRX, 18) -export type Tokens = { - [key in TokenSymbols]: Token; +export type TokensByTokenSymbol = { + [key in TokenSymbol]: Token; }; -export const tokens: Tokens = { +/** + * A dictionary mapping each token symbol to its corresponding initialised Token instance. + * This allows for easy lookup and provides a unified way to access token-specific details + * throughout the application. + */ +export const tokensByTokenSymbol: TokensByTokenSymbol = { ETH, WETH, STETH, From 61861250ca82baac1ff0ac63868e104fd98444ed Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Fri, 13 Oct 2023 15:07:14 +0100 Subject: [PATCH 14/17] chore: remove unnecessary newlines --- shared/token-symbol.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/shared/token-symbol.ts b/shared/token-symbol.ts index 1b92122..00e1513 100644 --- a/shared/token-symbol.ts +++ b/shared/token-symbol.ts @@ -45,7 +45,7 @@ export enum TokenSymbol { RWA005 = 'RWA005', RWA006 = 'RWA006', SDAI = 'SDAI', // Some specific version of DAI - TBTC = 'TBTC', // tBTC (tokenized Bitcoin on Ethereum) + TBTC = 'TBTC', // tBTC (tokenised Bitcoin on Ethereum) TUSD = 'TUSD', // TrueUSD UNIV2AAVEETH = 'UNIV2AAVEETH', // Uniswap V2 AAVE-ETH Liquidity Pool Token UNIV2DAIETH = 'UNIV2DAIETH', // Uniswap V2 DAI-ETH Liquidity Pool Token @@ -63,8 +63,4 @@ export enum TokenSymbol { YIELDETH = 'YIELDETH', // Yield instrument for ETH YFI = 'YFI', // yearn.finance ZRX = 'ZRX', // 0x -} - - - - +} \ No newline at end of file From 4e6094aa5fc30e84ac645c6bcae9bf94bc43b9d1 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Mon, 16 Oct 2023 09:28:59 +0100 Subject: [PATCH 15/17] fix: process Piotr review points --- configs/domain/get-lending-protocols.ts | 3 ++- configs/domain/get-networks.ts | 2 +- configs/domain/index.ts | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/configs/domain/get-lending-protocols.ts b/configs/domain/get-lending-protocols.ts index f9906a8..29bad42 100644 --- a/configs/domain/get-lending-protocols.ts +++ b/configs/domain/get-lending-protocols.ts @@ -1,8 +1,9 @@ import { LendingProtocol, LendingProtocolLabel } from "🤝"; type LendingProtocolLabelValueType = typeof LendingProtocolLabel[keyof typeof LendingProtocolLabel]; +type LabelByLendingProtocol = Record; -export const getLendingProtocols = (): Record => { +export const getLabelByLendingProtocol = (): LabelByLendingProtocol => { return { [LendingProtocol.AaveV2]: LendingProtocolLabel.aavev2, [LendingProtocol.AaveV3]: LendingProtocolLabel.aavev3, diff --git a/configs/domain/get-networks.ts b/configs/domain/get-networks.ts index 4848162..1496977 100644 --- a/configs/domain/get-networks.ts +++ b/configs/domain/get-networks.ts @@ -1,6 +1,6 @@ import {EnumToObject, enumToObject} from "🛠️"; import {Network} from "🤝"; -export const getNetworks = (): EnumToObject => { +export const getNetworkNameByNetwork = (): EnumToObject => { return enumToObject(Network) }; \ No newline at end of file diff --git a/configs/domain/index.ts b/configs/domain/index.ts index 5a9dd85..f21daa4 100644 --- a/configs/domain/index.ts +++ b/configs/domain/index.ts @@ -1,6 +1,6 @@ import {getDenominationSymbols} from "./get-denomination-symbols"; -import {getLendingProtocols} from "./get-lending-protocols"; -import {getNetworks} from "./get-networks"; +import {getLabelByLendingProtocol} from "./get-lending-protocols"; +import {getNetworkNameByNetwork} from "./get-networks"; import {getTokensByNetwork} from "./get-tokens-by-network"; import {getTokensByTokenSymbol} from "./get-tokens-by-token-symbol"; @@ -12,10 +12,10 @@ export default function () { * Possible extensions could include Products / Product categories / Strategies etc */ return { - tokens: getTokensByTokenSymbol(), + tokensByTokenSymbol: getTokensByTokenSymbol(), tokensByNetwork: getTokensByNetwork(), - lendingProtocols: getLendingProtocols(), - networks: getNetworks(), + labelByLendingProtocol: getLabelByLendingProtocol(), + networkNameByNetwork: getNetworkNameByNetwork(), denominationSymbols: getDenominationSymbols() }; } From eb7aae9f4f2f590803666d1da91f175e2a497057 Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Tue, 17 Oct 2023 09:08:07 +0100 Subject: [PATCH 16/17] fix: update getDenominationSymbols ->labelByDenominationSymbol --- configs/domain/get-denomination-symbols.ts | 2 +- configs/domain/get-tokens-by-token-symbol.ts | 2 +- configs/domain/index.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configs/domain/get-denomination-symbols.ts b/configs/domain/get-denomination-symbols.ts index cc250ef..1196e33 100644 --- a/configs/domain/get-denomination-symbols.ts +++ b/configs/domain/get-denomination-symbols.ts @@ -1,6 +1,6 @@ import {DenominationSymbol} from "🤝"; import {EnumToObject, enumToObject} from "🛠️"; -export const getDenominationSymbols = (): EnumToObject => { +export const getLabelByDenominationSymbols = (): EnumToObject => { return enumToObject(DenominationSymbol) }; \ No newline at end of file diff --git a/configs/domain/get-tokens-by-token-symbol.ts b/configs/domain/get-tokens-by-token-symbol.ts index 84fbc1d..51a5766 100644 --- a/configs/domain/get-tokens-by-token-symbol.ts +++ b/configs/domain/get-tokens-by-token-symbol.ts @@ -1,7 +1,7 @@ import {IToken, TokenSymbol, tokensByTokenSymbol} from "🤝"; -export const getTokensByTokenSymbol = (): Record> => { +export const getTokenByTokenSymbol = (): Record> => { const result: Record> = {} as unknown as Record>; for (const symbol of Object.keys(tokensByTokenSymbol) as TokenSymbol[]) { diff --git a/configs/domain/index.ts b/configs/domain/index.ts index f21daa4..d55cb24 100644 --- a/configs/domain/index.ts +++ b/configs/domain/index.ts @@ -1,8 +1,8 @@ -import {getDenominationSymbols} from "./get-denomination-symbols"; +import {getLabelByDenominationSymbols} from "./get-denomination-symbols"; import {getLabelByLendingProtocol} from "./get-lending-protocols"; import {getNetworkNameByNetwork} from "./get-networks"; +import {getTokenByTokenSymbol} from "./get-tokens-by-token-symbol"; import {getTokensByNetwork} from "./get-tokens-by-network"; -import {getTokensByTokenSymbol} from "./get-tokens-by-token-symbol"; export default function () { /** @@ -12,10 +12,10 @@ export default function () { * Possible extensions could include Products / Product categories / Strategies etc */ return { - tokensByTokenSymbol: getTokensByTokenSymbol(), + tokenByTokenSymbol: getTokenByTokenSymbol(), tokensByNetwork: getTokensByNetwork(), labelByLendingProtocol: getLabelByLendingProtocol(), networkNameByNetwork: getNetworkNameByNetwork(), - denominationSymbols: getDenominationSymbols() + labelByDenominationSymbol: getLabelByDenominationSymbols() }; } From 67f9e801d3237d5a9599c111847d168f870956ec Mon Sep 17 00:00:00 2001 From: James Tuckett Date: Tue, 17 Oct 2023 09:56:20 +0100 Subject: [PATCH 17/17] fix: remove extra S on getLabelByDenominationSymbols --- ...get-denomination-symbols.ts => get-denomination-symbol.ts} | 2 +- configs/domain/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename configs/domain/{get-denomination-symbols.ts => get-denomination-symbol.ts} (59%) diff --git a/configs/domain/get-denomination-symbols.ts b/configs/domain/get-denomination-symbol.ts similarity index 59% rename from configs/domain/get-denomination-symbols.ts rename to configs/domain/get-denomination-symbol.ts index 1196e33..7b79016 100644 --- a/configs/domain/get-denomination-symbols.ts +++ b/configs/domain/get-denomination-symbol.ts @@ -1,6 +1,6 @@ import {DenominationSymbol} from "🤝"; import {EnumToObject, enumToObject} from "🛠️"; -export const getLabelByDenominationSymbols = (): EnumToObject => { +export const getLabelByDenominationSymbol = (): EnumToObject => { return enumToObject(DenominationSymbol) }; \ No newline at end of file diff --git a/configs/domain/index.ts b/configs/domain/index.ts index d55cb24..9074ec9 100644 --- a/configs/domain/index.ts +++ b/configs/domain/index.ts @@ -1,4 +1,4 @@ -import {getLabelByDenominationSymbols} from "./get-denomination-symbols"; +import {getLabelByDenominationSymbol} from "./get-denomination-symbol"; import {getLabelByLendingProtocol} from "./get-lending-protocols"; import {getNetworkNameByNetwork} from "./get-networks"; import {getTokenByTokenSymbol} from "./get-tokens-by-token-symbol"; @@ -16,6 +16,6 @@ export default function () { tokensByNetwork: getTokensByNetwork(), labelByLendingProtocol: getLabelByLendingProtocol(), networkNameByNetwork: getNetworkNameByNetwork(), - labelByDenominationSymbol: getLabelByDenominationSymbols() + labelByDenominationSymbol: getLabelByDenominationSymbol() }; }