Skip to content

Commit d18ed0d

Browse files
committed
feat: add Yield+ feature
1 parent 54b2d44 commit d18ed0d

289 files changed

Lines changed: 11092 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: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import fakeAddress, { altAddress } from '__mocks__/models/address';
2+
import { poolData } from '__mocks__/models/pools';
3+
import type { YieldPlusPosition } from 'types';
4+
import { convertTokensToMantissa } from 'utilities';
5+
import { formatToYieldPlusPosition } from 'utilities/formatToYieldPlusPosition';
6+
7+
const pool = poolData[0];
8+
const xvsAsset = pool.assets[0];
9+
const usdcAsset = pool.assets[1];
10+
const usdtAsset = pool.assets[2];
11+
const busdAsset = pool.assets[3];
12+
13+
export const yieldPlusPositions: YieldPlusPosition[] = [
14+
formatToYieldPlusPosition({
15+
pool,
16+
chainId: busdAsset.vToken.underlyingToken.chainId,
17+
positionAccountAddress: fakeAddress,
18+
dsaVTokenAddress: xvsAsset.vToken.address,
19+
dsaBalanceMantissa: convertTokensToMantissa({
20+
value: xvsAsset.userSupplyBalanceTokens,
21+
token: xvsAsset.vToken.underlyingToken,
22+
}),
23+
longVTokenAddress: usdtAsset.vToken.address,
24+
shortVTokenAddress: busdAsset.vToken.address,
25+
leverageFactor: 2,
26+
unrealizedPnlCents: 0,
27+
unrealizedPnlPercentage: 0,
28+
averageEntryRatio: 1,
29+
})!,
30+
formatToYieldPlusPosition({
31+
pool,
32+
chainId: busdAsset.vToken.underlyingToken.chainId,
33+
positionAccountAddress: altAddress,
34+
dsaVTokenAddress: usdcAsset.vToken.address,
35+
dsaBalanceMantissa: convertTokensToMantissa({
36+
value: usdcAsset.userSupplyBalanceTokens,
37+
token: usdcAsset.vToken.underlyingToken,
38+
}),
39+
longVTokenAddress: usdtAsset.vToken.address,
40+
shortVTokenAddress: busdAsset.vToken.address,
41+
leverageFactor: 3,
42+
unrealizedPnlCents: 150,
43+
unrealizedPnlPercentage: 1.2,
44+
averageEntryRatio: 1.1,
45+
})!,
46+
];

0 commit comments

Comments
 (0)