Skip to content

Commit 91e3224

Browse files
authored
chore: move cdETI to legacy (#1846)
* add cdeti to legacy * remove cdeti references
1 parent 2c0cf24 commit 91e3224

File tree

13 files changed

+21
-100
lines changed

13 files changed

+21
-100
lines changed

src/app/legacy/config/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {
44
IndexDebtIssuanceModuleV2Address_v2,
55
} from '@indexcoop/flash-mint-sdk'
66

7-
import { LegacyToken } from '@/app/legacy/types'
8-
97
import {
108
BedIndex,
119
Bitcoin2xFlexibleLeverageIndex,
@@ -14,6 +12,7 @@ import {
1412
GMI,
1513
GitcoinStakedETHIndex,
1614
LeveragedRethStakingYield,
15+
cdETI,
1716
dsETH,
1817
ic21,
1918
} from './tokens/mainnet'
@@ -26,6 +25,8 @@ import {
2625
Matic2xFlexibleLeverageIndexPolygon,
2726
} from './tokens/polygon'
2827

28+
import type { LegacyToken } from '@/app/legacy/types'
29+
2930
const DebtIssuanceModuleAddress = '0x39F024d621367C044BacE2bf0Fb15Fb3612eCB92'
3031
const DebtIssuanceModuleV2PolygonAddress =
3132
'0xf2dC2f456b98Af9A6bEEa072AF152a7b0EaA40C9'
@@ -35,6 +36,7 @@ export const Issuance: { [key: string]: string } = {
3536
[Bitcoin2xFlexibleLeverageIndex.symbol]: DebtIssuanceModuleV2Address,
3637
[Bitcoin2xFlexibleLeverageIndexPolygon.symbol]:
3738
DebtIssuanceModuleV2PolygonAddress,
39+
[cdETI.symbol]: IndexDebtIssuanceModuleV2Address_v2,
3840
[DATA.symbol]: DebtIssuanceModuleAddress,
3941
[dsETH.symbol]: IndexDebtIssuanceModuleV2Address_v2,
4042
[Ethereum2xFlexibleLeverageIndex.symbol]: DebtIssuanceModuleV2Address,
@@ -63,6 +65,7 @@ export const LegacyTokenList: LegacyToken[] = [
6365
...Ethereum2xFlexibleLeverageIndex,
6466
image: Ethereum2xFlexibleLeverageIndex.logoURI,
6567
},
68+
{ ...cdETI, image: cdETI.logoURI },
6669
{ ...dsETH, image: dsETH.logoURI },
6770
{ ...ic21, image: ic21.logoURI },
6871
{ ...GitcoinStakedETHIndex, image: GitcoinStakedETHIndex.logoURI },

src/app/legacy/config/tokens/mainnet.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const Bitcoin2xFlexibleLeverageIndex = getTokenByChainAndSymbol(
55
1,
66
'BTC2x-FLI',
77
)
8+
export const cdETI = getTokenByChainAndSymbol(1, 'cdETI')
89
export const DATA = getTokenByChainAndSymbol(1, 'DATA')
910
export const dsETH = getTokenByChainAndSymbol(1, 'dsETH')
1011
export const Ethereum2xFlexibleLeverageIndex = getTokenByChainAndSymbol(

src/app/products/constants/tokens.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { getTokenByChainAndSymbol } from '@indexcoop/tokenlists'
22
import { arbitrum, mainnet } from 'viem/chains'
33

4-
import { ProductRow } from '@/app/products/types/product'
54
import {
65
buildEarnTradePath,
76
buildLegacyPath,
87
buildLeverageTradePath,
98
buildSwapTradePath,
109
} from '@/app/products/utils/trade-path'
1110

11+
import type { ProductRow } from '@/app/products/types/product'
12+
1213
export const productTokens: ProductRow[] = [
1314
{
1415
...getTokenByChainAndSymbol(arbitrum.id, 'iETH1X'),
@@ -76,12 +77,6 @@ export const productTokens: ProductRow[] = [
7677
listType: 'Strategies',
7778
tradeHref: buildLegacyPath(),
7879
},
79-
{
80-
...getTokenByChainAndSymbol(mainnet.id, 'cdETI'),
81-
hasApy: false,
82-
listType: 'Strategies',
83-
tradeHref: buildSwapTradePath('cdeti'),
84-
},
8580
{
8681
...getTokenByChainAndSymbol(arbitrum.id, 'ETH2xBTC'),
8782
hasApy: false,

src/constants/slippage.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { CoinDeskEthTrendIndex, HighYieldETHIndex, icETHIndex } from './tokens'
1+
import { HighYieldETHIndex, icETHIndex } from './tokens'
22

33
// Slippage default hard coded to 0.5%
44
export const slippageDefault = 0.5
55

66
export const slippageMap = new Map([
7-
[CoinDeskEthTrendIndex.symbol, 0.5],
87
[HighYieldETHIndex.symbol, 0.05],
98
[icETHIndex.symbol, 0.5],
109
])

src/constants/tokenlists.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { getTokenByChainAndSymbol } from '@indexcoop/tokenlists'
22
import { arbitrum, base } from 'viem/chains'
33

44
import {
5-
CoinDeskEthTrendIndex,
65
DAI,
76
DefiPulseIndex,
87
ETH,
@@ -13,7 +12,7 @@ import {
1312
RETH,
1413
SETH2,
1514
STETH,
16-
Token,
15+
type Token,
1716
USDC,
1817
USDT,
1918
WBTC,
@@ -53,7 +52,6 @@ export const indicesTokenList = [
5352
IndexToken,
5453
DefiPulseIndex,
5554
MetaverseIndex,
56-
CoinDeskEthTrendIndex,
5755
HighYieldETHIndex,
5856
{ ...icUSD, image: icUSD.logoURI },
5957
] as Token[]

src/constants/tokens.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ export interface Token {
1616
* Indices
1717
*/
1818

19-
export const CoinDeskEthTrendIndex: Token = {
20-
name: 'CoinDesk ETH Trend Index',
21-
symbol: 'cdETI',
22-
image:
23-
'https://uploads-ssl.webflow.com/62e3ff7a08cb1968bf057388/651f04818f458f918171c84d_cdETI-logo.svg',
24-
address: '0x55b2CFcfe99110C773f00b023560DD9ef6C8A13B',
25-
decimals: 18,
26-
}
27-
2819
export const DefiPulseIndex: Token = {
2920
name: 'DeFi Pulse Index',
3021
symbol: 'DPI',

src/lib/hooks/use-best-quote/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'
22
import { usePublicClient } from 'wagmi'
33

44
import { ARBITRUM } from '@/constants/chains'
5-
import {
6-
isAvailableForFlashMint,
7-
isAvailableForSwap,
8-
} from '@/lib/hooks/use-best-quote/utils/available'
5+
import { isAvailableForFlashMint } from '@/lib/hooks/use-best-quote/utils/available'
96
import { useNetwork } from '@/lib/hooks/use-network'
107
import { useWallet } from '@/lib/hooks/use-wallet'
118
import { parseUnits } from '@/lib/utils'
@@ -102,7 +99,7 @@ export const useBestQuote = (
10299
const outputTokenPrice = await getTokenPrice(outputToken, 1)
103100

104101
const canFlashmintIndexToken = isAvailableForFlashMint(indexToken)
105-
const canSwapIndexToken = isAvailableForSwap(indexToken)
102+
const canSwapIndexToken = true
106103

107104
const fetchFlashMintQuote = async () => {
108105
if (canFlashmintIndexToken) {
@@ -184,7 +181,7 @@ export const useBestQuote = (
184181
quoteFlashMint?.outputTokenAmountUsdAfterFees ?? null,
185182
)
186183
const canFlashmintIndexToken = isAvailableForFlashMint(indexToken)
187-
const canSwapIndexToken = isAvailableForSwap(indexToken)
184+
const canSwapIndexToken = true
188185
const results = {
189186
bestQuote,
190187
results: {
Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,10 @@
1-
import {
2-
CoinDeskEthTrendIndex,
3-
DefiPulseIndex,
4-
IndexToken,
5-
} from '@/constants/tokens'
1+
import { IndexToken } from '@/constants/tokens'
62

7-
import { isAvailableForFlashMint, isAvailableForSwap } from './available'
3+
import { isAvailableForFlashMint } from './available'
84

95
describe('isAvailableForFlashMint()', () => {
10-
test('returns true by default', async () => {
11-
const isAvailable = isAvailableForFlashMint(CoinDeskEthTrendIndex)
12-
expect(isAvailable).toBe(true)
13-
})
14-
156
test('should return false for INDEX swap availability', async () => {
167
const isAvailable = isAvailableForFlashMint(IndexToken)
178
expect(isAvailable).toBe(false)
189
})
1910
})
20-
21-
describe('isAvailableForSwap()', () => {
22-
test('returns true by default', async () => {
23-
const isAvailable = isAvailableForFlashMint(DefiPulseIndex)
24-
expect(isAvailable).toBe(true)
25-
})
26-
27-
test('should return false for cdETI swap availability', async () => {
28-
const isAvailable = isAvailableForSwap(CoinDeskEthTrendIndex)
29-
expect(isAvailable).toBe(false)
30-
})
31-
})
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
CoinDeskEthTrendIndex,
3-
IndexToken,
4-
type Token,
5-
} from '@/constants/tokens'
1+
import { IndexToken, type Token } from '@/constants/tokens'
62

73
export function isAvailableForFlashMint(token: Token): boolean {
84
switch (token.symbol) {
@@ -12,12 +8,3 @@ export function isAvailableForFlashMint(token: Token): boolean {
128
return true
139
}
1410
}
15-
16-
export function isAvailableForSwap(token: Token): boolean {
17-
switch (token.symbol) {
18-
case CoinDeskEthTrendIndex.symbol:
19-
return false
20-
default:
21-
return true
22-
}
23-
}

src/lib/utils/gas-defaults.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
CoinDeskEthTrendIndex,
32
DefiPulseIndex,
43
HighYieldETHIndex,
54
MetaverseIndex,
@@ -9,8 +8,6 @@ import {
98
export function getFlashMintGasDefault(symbol: string) {
109
// INDEX are not available for flash mint
1110
switch (symbol) {
12-
case CoinDeskEthTrendIndex.symbol:
13-
return 500_000
1411
case DefiPulseIndex.symbol:
1512
return 2_000_000
1613
case HighYieldETHIndex.symbol:

0 commit comments

Comments
 (0)