Skip to content

Commit 19e8674

Browse files
committed
feat: add Yield+ feature
1 parent e00698e commit 19e8674

300 files changed

Lines changed: 12168 additions & 1045 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/chilly-pugs-trade.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@venusprotocol/evm": minor
3+
---
4+
5+
add Yield+ page structure

.changeset/dark-doodles-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@venusprotocol/evm": minor
3+
---
4+
5+
refactor input components

.changeset/early-peas-create.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@venusprotocol/ui": minor
3+
"@venusprotocol/evm": minor
4+
---
5+
6+
add Increase form

.changeset/fast-radios-vanish.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@venusprotocol/ui": minor
3+
"@venusprotocol/evm": minor
4+
---
5+
6+
add Open Yield+ position form

apps/evm/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"i18next": "^25.0.0",
6363
"i18next-browser-languagedetector": "^8.2.0",
6464
"immer": "^10.1.1",
65+
"klinecharts": "^10.0.0-beta1",
6566
"lodash": "^4.17.21",
6667
"lodash.merge": "^4.6.2",
6768
"motion": "^12.0.3",

apps/evm/src/App/Routes/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ const Bridge = safeLazyLoad(() => import('pages/Bridge'));
3030
const Skills = safeLazyLoad(() => import('pages/Skills'));
3131
const PrivacyPolicy = safeLazyLoad(() => import('pages/PrivacyPolicy'));
3232
const TermsOfUse = safeLazyLoad(() => import('pages/TermsOfUse'));
33+
const YieldPlus = safeLazyLoad(() => import('pages/YieldPlus'));
3334

3435
const AppRoutes = () => {
3536
const location = useLocation();
3637
const swapRouteEnabled = useIsFeatureEnabled({ name: 'swapRoute' });
3738
const vaiRouteEnabled = useIsFeatureEnabled({ name: 'vaiRoute' });
3839
const bridgeEnabled = useIsFeatureEnabled({ name: 'bridgeRoute' });
40+
const yieldPlusRouteEnabled = useIsFeatureEnabled({ name: 'yieldPlus' });
3941
const primeCalculatorEnabled = useIsFeatureEnabled({
4042
name: 'primeCalculator',
4143
});
@@ -176,6 +178,17 @@ const AppRoutes = () => {
176178
}
177179
/>
178180

181+
{yieldPlusRouteEnabled && (
182+
<Route
183+
path={Subdirectory.YIELD_PLUS}
184+
element={
185+
<PageSuspense>
186+
<YieldPlus />
187+
</PageSuspense>
188+
}
189+
/>
190+
)}
191+
179192
{swapRouteEnabled && (
180193
<Route
181194
path={Subdirectory.SWAP}

apps/evm/src/App/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { QueryClientProvider } from '@tanstack/react-query';
2-
import { queryClient } from 'clients/api';
2+
import { queryClient } from 'clients/api/queryClient';
33
import config from 'config';
44
import { AnalyticProvider } from 'libs/analytics';
55
import { ErrorBoundary } from 'libs/errors';

apps/evm/src/__mocks__/models/swap.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ExactInSwapQuote } from 'types';
1+
import type { ApproximateOutSwapQuote, ExactInSwapQuote } from 'types';
22
import { lisUsd, usdc } from './tokens';
33

44
export const exactInSwapQuote: ExactInSwapQuote = {
@@ -11,3 +11,14 @@ export const exactInSwapQuote: ExactInSwapQuote = {
1111
minimumToTokenAmountReceivedMantissa: 100000000n,
1212
callData: '0x',
1313
};
14+
15+
export const approximateOutSwapQuote: ApproximateOutSwapQuote = {
16+
fromToken: lisUsd,
17+
toToken: usdc,
18+
direction: 'approximate-out',
19+
priceImpactPercentage: 0.1,
20+
fromTokenAmountSoldMantissa: 100000000n,
21+
expectedToTokenAmountReceivedMantissa: 100000000n,
22+
minimumToTokenAmountReceivedMantissa: 100000000n,
23+
callData: '0x',
24+
};

apps/evm/src/__mocks__/models/transactions.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,6 @@ export const transactions = {
8888
token: usdt,
8989
txType: 'exit_market',
9090
},
91-
{
92-
accountAddress: '0x3d759121234cd36F8124C21aFe1c6852d2bEd848',
93-
amountCents: new BigNumber('0'),
94-
amountTokens: new BigNumber(
95-
'115792089237316195423570985008687907853269984665640564039457584007913129639935',
96-
),
97-
blockNumber: '41114008',
98-
blockTimestamp: new Date('2024-08-02T02:18:00.000Z'),
99-
chainId: 97,
100-
contractAddress: '0xb7526572FFE56AB9D7489838Bf2E18e3323b441A',
101-
hash: '0xb0435b135762a7ca2ad7dccb9aa6c7f50237c6139b16a76348d6c64dfece110e',
102-
poolName: 'Metaverse',
103-
vTokenSymbol: vUsdtCorePool.symbol,
104-
token: vUsdtCorePool,
105-
txType: 'approve',
106-
},
10791
],
10892
count: 7,
10993
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import BigNumber from 'bignumber.js';
2+
3+
import fakeAddress, { altAddress } from '__mocks__/models/address';
4+
import { poolData } from '__mocks__/models/pools';
5+
import type { YieldPlusPosition } from 'types';
6+
import { convertTokensToMantissa } from 'utilities';
7+
import { formatToYieldPlusPosition } from 'utilities/formatToYieldPlusPosition';
8+
9+
const pool = poolData[0];
10+
const xvsAsset = pool.assets[0];
11+
const usdcAsset = pool.assets[1];
12+
const usdtAsset = pool.assets[2];
13+
const busdAsset = pool.assets[3];
14+
15+
export const yieldPlusPositions: YieldPlusPosition[] = [
16+
formatToYieldPlusPosition({
17+
pool,
18+
chainId: busdAsset.vToken.underlyingToken.chainId,
19+
positionAccountAddress: fakeAddress,
20+
dsaVTokenAddress: xvsAsset.vToken.address,
21+
dsaBalanceMantissa: convertTokensToMantissa({
22+
value: xvsAsset.userSupplyBalanceTokens,
23+
token: xvsAsset.vToken.underlyingToken,
24+
}),
25+
longVTokenAddress: usdtAsset.vToken.address,
26+
shortVTokenAddress: busdAsset.vToken.address,
27+
leverageFactor: 2,
28+
unrealizedPnlCents: 0,
29+
unrealizedPnlPercentage: 0,
30+
averageEntryRatio: 1,
31+
totalShortOpenedMantissa: new BigNumber(0),
32+
totalLongReceivedMantissa: new BigNumber(0),
33+
})!,
34+
formatToYieldPlusPosition({
35+
pool,
36+
chainId: busdAsset.vToken.underlyingToken.chainId,
37+
positionAccountAddress: altAddress,
38+
dsaVTokenAddress: usdcAsset.vToken.address,
39+
dsaBalanceMantissa: convertTokensToMantissa({
40+
value: usdcAsset.userSupplyBalanceTokens,
41+
token: usdcAsset.vToken.underlyingToken,
42+
}),
43+
longVTokenAddress: usdtAsset.vToken.address,
44+
shortVTokenAddress: busdAsset.vToken.address,
45+
leverageFactor: 3,
46+
unrealizedPnlCents: 150,
47+
unrealizedPnlPercentage: 1.2,
48+
averageEntryRatio: 1.1,
49+
totalShortOpenedMantissa: new BigNumber(0),
50+
totalLongReceivedMantissa: new BigNumber(0),
51+
})!,
52+
];

0 commit comments

Comments
 (0)