Skip to content

Commit

Permalink
Merge branch 'main' into refactor/wallet-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini authored Jan 29, 2025
2 parents 5cda05a + 8e19017 commit 1c91cca
Show file tree
Hide file tree
Showing 95 changed files with 3,572 additions and 127 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ This repository is organized as follows:
- `/apps/lend`: Lend [React](https://react.dev/) application.
- `/tests`: DApp tests
- `/packages/curve-ui-kit`: Shared UI kit created using Material UI, mapped as `@ui-kit`
- `/packages/prices-api`: Package for consuming the Prices API, mapped as `@curvefi/prices-api`. Soon to be to separated its own NPM package.

## Development Guide

Expand Down
53 changes: 0 additions & 53 deletions apps/main/src/loan/components/PageLlamaMarkets/LendTableTitle.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions apps/main/src/loan/components/PageLlamaMarkets/Page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Box from '@mui/material/Box'
import Skeleton from '@mui/material/Skeleton'
import { LendTableTitle } from '@/loan/components/PageLlamaMarkets/LendTableTitle'
import { LendingMarketsTable } from '@/loan/components/PageLlamaMarkets/LendingMarketsTable'
import { LendTableFooter } from '@/loan/components/PageLlamaMarkets/LendTableFooter'
import { invalidateLendingVaults, useLendingVaults } from '@/loan/entities/vaults'
Expand All @@ -26,7 +25,6 @@ export const PageLlamaMarkets = () => {
return (
<Box sx={{ marginBlockEnd: Spacing.xxl }}>
<DocumentHead title={t`Llamalend Markets`} />
<LendTableTitle />
{isReady ? (
<LendingMarketsTable onReload={onReload} data={data.lendingVaultData} headerHeight={headerHeight} />
) : (
Expand Down
53 changes: 0 additions & 53 deletions apps/main/src/loan/entities/crvusd.ts

This file was deleted.

17 changes: 13 additions & 4 deletions apps/main/src/pages/dex.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NextPage } from 'next'
import dynamic from 'next/dynamic'
import { Navigate, Route, Routes } from 'react-router'
import { Navigate, Route, Routes, useParams } from 'react-router'
import { REFRESH_INTERVAL, ROUTE } from '@/dex/constants'
import 'focus-visible'
import { i18n } from '@lingui/core'
Expand Down Expand Up @@ -157,10 +157,19 @@ const App: NextPage = () => {
isPageVisible,
)

/**
* Lazily use useParams() to preserve network parameter during redirects.
* Using Navigate instead of direct component rendering ensures proper
* menu highlighting via isActive state.
*/
const RootRedirect = () => {
const { network } = useParams()
return <Navigate to={`/${network ?? 'ethereum'}/pools`} />
}

const SubRoutes = (
<>
<Route path=":network" element={<PageSwap />} />
<Route path=":network/dashboard" element={<PageDashboard />} />
<Route path=":network" element={<RootRedirect />} />
<Route path=":network/locker" element={<PageLockedCrv />} />
<Route path=":network/locker/:lockedCrvFormType" element={<PageLockedCrv />} />
<Route path=":network/create-pool" element={<PageCreatePool />} />
Expand Down Expand Up @@ -212,7 +221,7 @@ const App: NextPage = () => {
path="/disclaimer"
element={<Navigate to={`/ethereum${ROUTE.PAGE_DISCLAIMER}`} replace />}
/>
<Route path="/" element={<Navigate to={`/ethereum${ROUTE.PAGE_SWAP}`} />} />
<Route path="/" element={<Navigate to={`/ethereum${ROUTE.PAGE_POOLS}`} />} />
<Route path="404" element={<Page404 />} />
<Route path="*" element={<Page404 />} />
</Routes>
Expand Down
4 changes: 3 additions & 1 deletion apps/main/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"@ui": ["../../../packages/ui/src/index.ts"],
"@ui/*": ["../../../packages/ui/src/*"],
"@ui-kit/*": ["../../../packages/curve-ui-kit/src/*"],
"@external-rewards": ["../../../packages/external-rewards/src/index.ts"]
"@external-rewards": ["../../../packages/external-rewards/src/index.ts"],
"@curvefi/prices-api": ["../../../packages/prices-api/src/index.ts"],
"@curvefi/prices-api/*": ["../../../packages/prices-api/src/*"]
}
},
"exclude": ["node_modules", "cypress"],
Expand Down
12 changes: 11 additions & 1 deletion packages/eslint-config-custom/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
module.exports = {
extends: ['next', 'turbo', 'prettier'],
plugins: ['no-only-tests', 'unused-imports'],
plugins: ['no-only-tests', 'unused-imports', 'import'],
rules: {
'arrow-body-style': ['error', 'as-needed'],
'no-only-tests/no-only-tests': 'error',
'@next/next/no-img-element': 'off',
'@next/next/no-html-link-for-pages': 'off',
'unused-imports/no-unused-imports': 'warn',
'import/no-restricted-paths': [
'error',
{
basePath: '../../apps/main/src',
zones: ['dex', 'dao', 'lend', 'loan'].map((from, _, targets) => ({
from,
target: targets.filter((a) => a !== from),
})),
},
],
},
parser: '@typescript-eslint/parser',
settings: {
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.1.2",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-no-only-tests": "^3.3.0",
"eslint-plugin-react": "7.36.1",
"eslint-plugin-unused-imports": "^3.2.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/external-rewards/src/campaign-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,8 @@
},
{
"campaign": "Hourglass.json"
},
{
"campaign": "Fx.json"
}
]
69 changes: 69 additions & 0 deletions packages/external-rewards/src/campaigns/Fx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"campaignName": "",
"platform": "F(x) Protocol",
"description": "External token rewards for providing liquidity.",
"platformImageId": "fx.png",
"dashboardLink": "https://fx.aladdin.club/",
"pools": [
{
"id": "null",
"action": "lp",
"description": "Deposit your Curve LP tokens on f(x) Protocol and earn FXN rewards or on Convex and earn CRV and FXN rewards. For more information please visit f(x) Protocol",
"campaignStart": "0",
"campaignEnd": "1770000000",
"address": "0x5018be882dcce5e3f2f3b0913ae2096b9b3fb61f",
"network": "ethereum",
"multiplier": "FXN",
"tags": ["tokens"],
"lock": "false"
},
{
"id": "null",
"action": "lp",
"description": "Deposit your Curve LP tokens on f(x) Protocol and earn FXN rewards or on Convex and earn CRV and FXN rewards. For more information please visit f(x) Protocol",
"campaignStart": "0",
"campaignEnd": "1770000000",
"address": "0x74345504eaea3d9408fc69ae7eb2d14095643c5b",
"network": "ethereum",
"multiplier": "FXN",
"tags": ["tokens"],
"lock": "false"
},
{
"id": "null",
"action": "lp",
"description": "Deposit your Curve LP tokens on f(x) Protocol and earn FXN rewards or on Convex and earn CRV and FXN rewards. For more information please visit f(x) Protocol",
"campaignStart": "0",
"campaignEnd": "1770000000",
"address": "0x189b4e49b5caf33565095097b4b960f14032c7d0",
"network": "ethereum",
"multiplier": "FXN",
"tags": ["tokens"],
"lock": "false"
},
{
"id": "null",
"action": "lp",
"description": "Deposit your Curve LP tokens on f(x) Protocol and earn FXN rewards or on Convex and earn CRV and FXN rewards. For more information please visit f(x) Protocol",
"campaignStart": "0",
"campaignEnd": "1770000000",
"address": "0xc15f285679a1ef2d25f53d4cbd0265e1d02f2a92",
"network": "ethereum",
"multiplier": "FXN",
"tags": ["tokens"],
"lock": "false"
},
{
"id": "null",
"action": "lp",
"description": "Deposit your Curve LP tokens on f(x) Protocol and earn FXN rewards or on Convex and earn CRV and FXN rewards. For more information please visit f(x) Protocol",
"campaignStart": "0",
"campaignEnd": "1770000000",
"address": "0x8ffc7b89412efd0d17edea2018f6634ea4c2fcb2",
"network": "ethereum",
"multiplier": "FXN",
"tags": ["tokens"],
"lock": "false"
}
]
}
4 changes: 2 additions & 2 deletions packages/external-rewards/src/campaigns/Kelpdao.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"campaignName": "Kelp Miles",
"campaignName": "Kernel Points",
"platform": "Kelp DAO",
"description": "Points for providing liquidity",
"platformImageId": "kelpdao.png",
"platformImageId": "kelpdao-kernels.png",
"dashboardLink": "https://kelpdao.xyz/dashboard/",
"pools": [
{
Expand Down
6 changes: 3 additions & 3 deletions packages/external-rewards/src/campaigns/Usual.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"campaignName": "",
"platform": "Usual",
"description": "Points for providing liquidity.",
"description": "External token rewards for providing liquidity.",
"platformImageId": "usual.png",
"dashboardLink": "https://app.usual.money/",
"pools": [
Expand All @@ -14,7 +14,7 @@
"address": "0x1d08e7adc263cfc70b1babe6dc5bb339c16eec52",
"network": "ethereum",
"multiplier": "usual",
"tags": ["points"],
"tags": ["tokens"],
"lock": "false"
},
{
Expand All @@ -26,7 +26,7 @@
"address": "0x14100f81e33c33ecc7cdac70181fb45b6e78569f",
"network": "ethereum",
"multiplier": "usual",
"tags": ["points"],
"tags": ["tokens"],
"lock": "false"
}
]
Expand Down
2 changes: 2 additions & 0 deletions packages/external-rewards/src/campaigns/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import YieldFi from './YieldFi.json'
import Babylon from './Babylon.json'
import Vnx from './Vnx.json'
import Hourglass from './Hourglass.json'
import Fx from './Fx.json'

export {
DLCLink,
Expand Down Expand Up @@ -56,4 +57,5 @@ export {
Babylon,
Vnx,
Hourglass,
Fx,
}
21 changes: 21 additions & 0 deletions packages/prices-api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@curvefi/prices-api",
"version": "1.0.0",
"type": "module",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "MIT",
"private": true,
"scripts": {
"lint": "eslint \"**/*.ts*\"",
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"typescript": "*"
},
"devDependencies": {
"eslint": "*",
"eslint-config-custom": "*",
"typescript": "*"
}
}
32 changes: 32 additions & 0 deletions packages/prices-api/src/chains/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { getHost, type Options, type Chain } from '..'
import { fetchJson as fetch } from '../fetch'
import type * as Responses from './responses'
import * as Parsers from './parsers'

export async function getSupportedChains(options?: Options) {
const host = getHost(options)
const resp = await fetch<Responses.GetSupportedChainsResponse>(`${host}/v1/chains/`)

return Parsers.parseSupportedChains(resp)
}

export async function getChainInfo(chain: Chain, options?: Options) {
const host = getHost(options)
const resp = await fetch<Responses.GetChainInfoResponse>(`${host}/v1/chains/${chain}?page=1&per_page=1`)

return Parsers.parseChainInfo(resp)
}

export async function getTxs(options?: Options) {
const host = getHost(options)
const resp = await fetch<Responses.GetTransactionsResponse>(`${host}/v1/chains/activity/transactions`)

return Parsers.parseTxs(resp)
}

export async function getUsers(options?: Options) {
const host = getHost(options)
const resp = await fetch<Responses.GetUsersResponse>(`${host}/v1/chains/activity/users`)

return Parsers.parseUsers(resp)
}
Loading

0 comments on commit 1c91cca

Please sign in to comment.