Skip to content

Commit 7ee705d

Browse files
committed
Merge remote-tracking branch 'origin/master' into chore/refactor-tooltip-usage
2 parents 89635f6 + 7d13309 commit 7ee705d

File tree

38 files changed

+902
-538
lines changed

38 files changed

+902
-538
lines changed

.vscode/settings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"editor.codeActionsOnSave": {
3-
"source.organizeImports": "always"
4-
},
2+
"editor.codeActionsOnSave": [
3+
"source.organizeImports",
4+
"source.fixAll"
5+
],
56
"editor.defaultFormatter": "esbenp.prettier-vscode",
67
"editor.formatOnSave": true,
78
"typescript.preferences.importModuleSpecifier": "non-relative",

next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const nextConfig = {
4545
{
4646
protocol: 'https',
4747
hostname: 'raw.githubusercontent.com',
48+
pathname: '/trustwallet/assets/master/blockchains/ethereum/assets/**',
4849
},
4950
],
5051
},

package-lock.json

Lines changed: 433 additions & 191 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
"@heroicons/react": "^2.1.3",
3030
"@indexcoop/analytics-sdk": "0.29.0",
3131
"@indexcoop/flash-mint-sdk": "3.24.0",
32-
"@indexcoop/tokenlists": "3.11.0",
32+
"@indexcoop/tokenlists": "3.11.1",
3333
"@next/third-parties": "15.1.7",
34-
"@reown/appkit": "1.6.5",
35-
"@reown/appkit-adapter-wagmi": "1.6.5",
34+
"@reown/appkit": "1.6.9",
35+
"@reown/appkit-adapter-wagmi": "1.6.9",
3636
"@safe-global/api-kit": "2.5.4",
3737
"@safe-global/protocol-kit": "4.0.4",
3838
"@safe-global/safe-core-sdk-types": "5.0.3",
@@ -54,12 +54,13 @@
5454
"lodash": "4.17.21",
5555
"next": "14.2.13",
5656
"react": "^18.2.0",
57+
"react-device-detect": "2.2.3",
5758
"react-dom": "^18.2.0",
5859
"react-loading-skeleton": "3.5.0",
5960
"tailwind-merge": "2.5.2",
6061
"use-debounce": "^10.0.1",
61-
"viem": "2.22.21",
62-
"wagmi": "2.14.9"
62+
"viem": "2.23.6",
63+
"wagmi": "2.14.12"
6364
},
6465
"devDependencies": {
6566
"@jest/globals": "^29.5.0",
4.46 KB
Loading

src/app/earn/components/earn-widget/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ import { WarningType } from '@/components/swap/components/warning'
1717
import { TradeButtonState } from '@/components/swap/hooks/use-trade-button-state'
1818
import { TokenDisplay } from '@/components/token-display'
1919
import { useDisclosure } from '@/lib/hooks/use-disclosure'
20+
import { useGasData } from '@/lib/hooks/use-gas-data'
2021
import { useSupportedNetworks } from '@/lib/hooks/use-network'
2122
import { useWallet } from '@/lib/hooks/use-wallet'
2223
import { useSlippage } from '@/lib/providers/slippage'
2324
import { formatWei } from '@/lib/utils'
25+
import { getMaxBalance } from '@/lib/utils/max-balance'
2426

2527
import { useFormattedEarnData } from '../../use-formatted-data'
2628

@@ -29,6 +31,7 @@ import './styles.css'
2931
const hiddenLeverageWarnings = [WarningType.flashbots]
3032

3133
export function EarnWidget() {
34+
const gasData = useGasData()
3235
const isSupportedNetwork = useSupportedNetworks(supportedNetworks)
3336
const { queryParams } = useQueryParams()
3437
const { address } = useWallet()
@@ -86,8 +89,9 @@ export function EarnWidget() {
8689

8790
const onClickBalance = useCallback(() => {
8891
if (!inputBalance) return
89-
onChangeInputTokenAmount(formatWei(inputBalance, inputToken.decimals))
90-
}, [inputBalance, inputToken, onChangeInputTokenAmount])
92+
const maxBalance = getMaxBalance(inputToken, inputBalance, gasData)
93+
onChangeInputTokenAmount(formatWei(maxBalance, inputToken.decimals))
94+
}, [gasData, inputBalance, inputToken, onChangeInputTokenAmount])
9195

9296
useEffect(() => {
9397
setSlippageForToken(isMinting ? outputToken.symbol : inputToken.symbol)

src/app/earn/constants.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@ function createToken(chainId: number, symbol: string): Token {
88
return { ...token, image: token.logoURI }
99
}
1010

11-
export function getCurrencyTokens(chainId: number): Token[] {
11+
export function getCurrencyTokens(
12+
chainId: number,
13+
isIcETh: boolean = false,
14+
): Token[] {
1215
switch (chainId) {
1316
case mainnet.id:
14-
return [
15-
{ ...ETH, chainId: mainnet.id },
16-
createToken(mainnet.id, 'WETH'),
17-
createToken(mainnet.id, 'WBTC'),
18-
createToken(mainnet.id, 'USDC'),
19-
createToken(mainnet.id, 'USDT'),
20-
]
17+
return isIcETh
18+
? [{ ...ETH, chainId: mainnet.id }, createToken(mainnet.id, 'WETH')]
19+
: [
20+
{ ...ETH, chainId: mainnet.id },
21+
createToken(mainnet.id, 'WETH'),
22+
createToken(mainnet.id, 'WBTC'),
23+
createToken(mainnet.id, 'USDC'),
24+
createToken(mainnet.id, 'USDT'),
25+
]
2126
case arbitrum.id:
2227
return [
2328
{ ...ETH, chainId: arbitrum.id },
@@ -31,6 +36,7 @@ export function getCurrencyTokens(chainId: number): Token[] {
3136
{ ...ETH, chainId: base.id },
3237
createToken(base.id, 'WETH'),
3338
createToken(base.id, 'USDC'),
39+
createToken(base.id, 'wstETH'),
3440
]
3541
default:
3642
return []
@@ -43,6 +49,8 @@ export function getTagline(indexTokenSymbol: string): string {
4349
return 'The highest ETH-denominated yields on Ethereum Mainnet.'
4450
case 'iceth':
4551
return 'ETH staking returns using a leveraged liquid staking strategy.'
52+
case 'wsteth15x':
53+
return '15x ETH Smart Loop using a delta-neutral leveraged yield strategy.'
4654
default:
4755
return ''
4856
}
@@ -51,6 +59,7 @@ export function getTagline(indexTokenSymbol: string): string {
5159
// Uncomment bridged L2 tokens only when price feeds are available
5260
const yieldTokens = [
5361
getTokenByChainAndSymbol(mainnet.id, 'hyETH'),
62+
getTokenByChainAndSymbol(base.id, 'wstETH15x'),
5463
// getTokenByChainAndSymbol(arbitrum.id, 'hyETH'),
5564
// getTokenByChainAndSymbol(base.id, 'hyETH'),
5665
getTokenByChainAndSymbol(mainnet.id, 'icETH'),
@@ -66,4 +75,4 @@ export function getYieldTokens(): Token[] {
6675
return tokens
6776
}
6877

69-
export const supportedNetworks = [mainnet.id]
78+
export const supportedNetworks = [mainnet.id, base.id]

src/app/earn/provider.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { getTokenByChainAndSymbol } from '@indexcoop/tokenlists'
3+
import { getTokenByChainAndSymbol, isAddressEqual } from '@indexcoop/tokenlists'
44
import { useQuery } from '@tanstack/react-query'
55
import {
66
createContext,
@@ -33,6 +33,7 @@ import { getCurrencyTokens, getYieldTokens } from './constants'
3333

3434
const hyEthTokenlist = getTokenByChainAndSymbol(1, 'hyETH')
3535
const hyETH = { ...hyEthTokenlist, image: hyEthTokenlist.logoURI }
36+
const icETH = getTokenByChainAndSymbol(1, 'icETH')
3637

3738
interface Context {
3839
inputValue: string
@@ -138,14 +139,16 @@ export function EarnProvider(props: { children: any }) {
138139
)
139140

140141
const inputTokens = useMemo(() => {
141-
if (isMinting) return getCurrencyTokens(chainId)
142+
const isIcEth = isAddressEqual(indexToken.address, icETH.address)
143+
if (isMinting) return getCurrencyTokens(chainId, isIcEth)
142144
return indexTokens
143-
}, [chainId, indexTokens, isMinting])
145+
}, [chainId, indexTokens, indexToken, isMinting])
144146

145147
const outputTokens = useMemo(() => {
146-
if (!isMinting) return getCurrencyTokens(chainId)
148+
const isIcEth = isAddressEqual(indexToken.address, icETH.address)
149+
if (!isMinting) return getCurrencyTokens(chainId, isIcEth)
147150
return indexTokens
148-
}, [chainId, indexTokens, isMinting])
151+
}, [chainId, indexTokens, indexToken, isMinting])
149152

150153
const inputTokenAmount = useMemo(
151154
() =>

src/app/globals.css

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,70 @@
33
@tailwind base;
44
@tailwind components;
55
@tailwind utilities;
6+
7+
@keyframes smoothBg {
8+
0% {
9+
transform: scale(1) rotate(0deg);
10+
background-position:
11+
50% 50%,
12+
50% 50%;
13+
}
14+
50% {
15+
transform: scale(1.5) rotate(180deg);
16+
}
17+
100% {
18+
transform: scale(1) rotate(360deg);
19+
background-position:
20+
350% 50%,
21+
350% 50%;
22+
}
23+
}
24+
25+
.light-effect {
26+
width: 200%;
27+
height: 100%;
28+
min-height: 100vh;
29+
position: fixed;
30+
top: 0;
31+
left: -50%;
32+
display: flex;
33+
place-content: center;
34+
place-items: center;
35+
--stripes: repeating-linear-gradient(
36+
100deg,
37+
#0f1717 0%,
38+
#0f1717 7%,
39+
transparent 10%,
40+
transparent 12%,
41+
#0f1717 16%
42+
);
43+
44+
--rainbow: repeating-linear-gradient(
45+
100deg,
46+
rgba(0, 74, 80, 1) 25%,
47+
rgba(58, 122, 192, 0.7) 10%,
48+
rgba(7, 122, 82, 0.7) 15%,
49+
rgba(92, 179, 179, 0.7) 15%
50+
);
51+
background-image: var(--stripes), var(--rainbow);
52+
background-size: 400%, 00%;
53+
background-position:
54+
50% 50%,
55+
50% 50%;
56+
filter: blur(20px);
57+
mix-blend-mode: difference;
58+
mask-image: radial-gradient(ellipse at 100% 0%, black 40%, transparent 70%);
59+
}
60+
61+
.light-effect::after {
62+
content: '';
63+
position: absolute;
64+
will-change: transform;
65+
inset: 0;
66+
background-image: var(--stripes), var(--rainbow);
67+
background-size: 250%, 250%;
68+
animation: smoothBg 420s alternate infinite;
69+
background-attachment: fixed;
70+
mix-blend-mode: difference;
71+
filter: blur(10px) opacity(50%) saturate(200%);
72+
}

src/app/legacy/components/redeem-widget/index.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { QuoteType } from '@/lib/hooks/use-best-quote/types'
1919
import { useDisclosure } from '@/lib/hooks/use-disclosure'
2020
import { useSupportedNetworks } from '@/lib/hooks/use-network'
2121
import { useWallet } from '@/lib/hooks/use-wallet'
22-
import { useSignTerms } from '@/lib/providers/sign-terms-provider'
2322
import { formatWei } from '@/lib/utils'
2423

2524
import { useRedeem } from '../../providers/redeem-provider'
@@ -37,7 +36,6 @@ export function RedeemWidget() {
3736
POLYGON.chainId,
3837
])
3938
const { open } = useAppKit()
40-
const { signTermsOfService } = useSignTerms()
4139
const { address } = useWallet()
4240
const {
4341
inputTokenList,
@@ -129,11 +127,6 @@ export function RedeemWidget() {
129127
return
130128
}
131129

132-
if (buttonState === TradeButtonState.signTerms) {
133-
await signTermsOfService()
134-
return
135-
}
136-
137130
if (buttonState === TradeButtonState.wrongNetwork) {
138131
open({ view: 'Networks' })
139132

@@ -159,7 +152,6 @@ export function RedeemWidget() {
159152
buttonState,
160153
isApproved,
161154
onApprove,
162-
signTermsOfService,
163155
onOpenTransactionReview,
164156
open,
165157

0 commit comments

Comments
 (0)