Skip to content

Commit

Permalink
merge isolated-lending branch with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
therealemjy committed Nov 30, 2022
1 parent 21a916b commit d88b195
Show file tree
Hide file tree
Showing 238 changed files with 6,084 additions and 4,270 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Jira ticket(s)

[VEN-XXX](https://jira.toolsfdg.net/browse/VEN-XXX)
[VEN-XXX](VEN-XXX)

## Changes

Expand Down
1 change: 1 addition & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
customSyntax: '@stylelint/postcss-css-in-js',
rules: {
'at-rule-empty-line-before': null,
'function-name-case': null,
'at-rule-no-unknown': [
true,
{
Expand Down
2 changes: 2 additions & 0 deletions src/__mocks__/contracts/comptroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ const comptrollerResponses: {
getHypotheticalAccountLiquidity: Awaited<
ReturnType<ReturnType<Comptroller['methods']['getHypotheticalAccountLiquidity']>['call']>
>;
mintedVAIs: Awaited<ReturnType<ReturnType<Comptroller['methods']['mintedVAIs']>['call']>>;
} = {
venusVAIVaultRate: '5000000000',
getHypotheticalAccountLiquidity: {
0: '100000000',
1: '200000000',
2: '300000000',
},
mintedVAIs: '60000000000000000',
};

export default comptrollerResponses;
8 changes: 8 additions & 0 deletions src/__mocks__/models/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export const assetData: Asset[] = [
token: TOKENS.sxp,
supplyApy: new BigNumber('0.05225450324405023'),
borrowApy: new BigNumber('-2.3062487835658776'),
xvsSupplyApr: new BigNumber('0.01720675342484096'),
xvsSupplyApy: new BigNumber('0.11720675342484096'),
xvsBorrowApr: new BigNumber('4.07469243006608279'),
xvsBorrowApy: new BigNumber('4.17469243006608279'),
collateralFactor: new BigNumber('0.5'),
tokenPrice: new BigNumber('1.2786734'),
Expand All @@ -29,7 +31,9 @@ export const assetData: Asset[] = [
token: TOKENS.usdc,
supplyApy: new BigNumber('3.887242555711379188'),
borrowApy: new BigNumber('-5.361233028654066'),
xvsSupplyApr: new BigNumber('1.153105649796123742'),
xvsSupplyApy: new BigNumber('1.353105649796123742'),
xvsBorrowApr: new BigNumber('1.370327607690572731'),
xvsBorrowApy: new BigNumber('1.670327607690572731'),
collateralFactor: new BigNumber('0.8'),
tokenPrice: new BigNumber('0.9999364'),
Expand All @@ -50,7 +54,9 @@ export const assetData: Asset[] = [
token: TOKENS.usdt,
supplyApy: new BigNumber('3.593608909332766999'),
borrowApy: new BigNumber('-4.9748661428011145'),
xvsSupplyApr: new BigNumber('0.221719501189155143'),
xvsSupplyApy: new BigNumber('0.421719501189155143'),
xvsBorrowApr: new BigNumber('0.322209972682294832'),
xvsBorrowApy: new BigNumber('0.522209972682294832'),
collateralFactor: new BigNumber('0.8'),
tokenPrice: new BigNumber('1.00024602'),
Expand All @@ -71,7 +77,9 @@ export const assetData: Asset[] = [
token: TOKENS.busd,
supplyApy: new BigNumber('2.886396363044176106'),
borrowApy: new BigNumber('-4.050271277344538'),
xvsSupplyApr: new BigNumber('0.578420831753642169'),
xvsSupplyApy: new BigNumber('0.678420831753642169'),
xvsBorrowApr: new BigNumber('0.552697602175970714'),
xvsBorrowApy: new BigNumber('0.852697602175970714'),
collateralFactor: new BigNumber('0.8'),
tokenPrice: new BigNumber('1.00000922'),
Expand Down
42 changes: 40 additions & 2 deletions src/__mocks__/models/markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export const markets: Market[] = [
collateralFactor: '500000000000000000',
borrowApy: new BigNumber(-4.6398079628683675),
supplyApy: new BigNumber('1.045586251269331278'),
borrowVenusApr: new BigNumber('1.051224864211795426'),
borrowVenusApy: new BigNumber('1.351224864211795426'),
supplyVenusApr: new BigNumber('0.14260730848036692'),
supplyVenusApy: new BigNumber('0.34260730848036692'),
liquidity: new BigNumber('1990848.674369169595929844'),
tokenPrice: new BigNumber('0.67408826'),
Expand Down Expand Up @@ -75,7 +77,9 @@ export const markets: Market[] = [
collateralFactor: '810000000000000000',
borrowApy: new BigNumber(-2.0144969997738267),
supplyApy: new BigNumber('0.000001539982091825'),
borrowVenusApr: new BigNumber('0.000001125348834693'),
borrowVenusApy: new BigNumber('0.000002125348834693'),
supplyVenusApr: new BigNumber('0.000000000000824635'),
supplyVenusApy: new BigNumber('0.000000000001824635'),
liquidity: new BigNumber('10001830379044496325.01359740607398'),
tokenPrice: new BigNumber('1.00008302'),
Expand Down Expand Up @@ -118,7 +122,9 @@ export const markets: Market[] = [
collateralFactor: '800000000000000000',
borrowApy: new BigNumber(-2.014488268288307),
supplyApy: new BigNumber('0'),
borrowVenusApr: new BigNumber('0.200882672824011072'),
borrowVenusApy: new BigNumber('0.600882672824011072'),
supplyVenusApr: new BigNumber('0'),
supplyVenusApy: new BigNumber('0'),
liquidity: new BigNumber('1009799010007156812504041.9628840351'),
tokenPrice: new BigNumber('0.9999'),
Expand Down Expand Up @@ -161,7 +167,9 @@ export const markets: Market[] = [
collateralFactor: '800000000000000000',
borrowApy: new BigNumber(-2.8269802937000055),
supplyApy: new BigNumber('0.222026939368167748'),
borrowVenusApr: new BigNumber('0.001753286763848276'),
borrowVenusApy: new BigNumber('0.021753286763848276'),
supplyVenusApr: new BigNumber('0.000730355354365121'),
supplyVenusApy: new BigNumber('0.001730355354365121'),
liquidity: new BigNumber('9708012785.783380684153495733'),
tokenPrice: new BigNumber('1.00019714'),
Expand Down Expand Up @@ -204,7 +212,9 @@ export const markets: Market[] = [
collateralFactor: '800000000000000000',
borrowApy: new BigNumber(-94.54098055818199),
supplyApy: new BigNumber('86.319696955441989068'),
borrowVenusApr: new BigNumber('1.041107132664179593'),
borrowVenusApy: new BigNumber('1.141107132664179593'),
supplyVenusApr: new BigNumber('1.085821799653397884'),
supplyVenusApy: new BigNumber('1.185821799653397884'),
liquidity: new BigNumber('39.742992883765334217'),
tokenPrice: new BigNumber('294.99354795'),
Expand Down Expand Up @@ -247,7 +257,9 @@ export const markets: Market[] = [
collateralFactor: '600000000000000000',
borrowApy: new BigNumber(-19.90282685098207),
supplyApy: new BigNumber('2.509901167951039272'),
borrowVenusApr: new BigNumber('0'),
borrowVenusApy: new BigNumber('0'),
supplyVenusApr: new BigNumber('0'),
supplyVenusApy: new BigNumber('0'),
liquidity: new BigNumber('1384009.148852251251535718'),
tokenPrice: new BigNumber('1'),
Expand Down Expand Up @@ -290,7 +302,9 @@ export const markets: Market[] = [
collateralFactor: '800000000000000000',
borrowApy: new BigNumber(-5.7292945208867785),
supplyApy: new BigNumber('1.814867084183460806'),
borrowVenusApr: new BigNumber('3.543731091576054636'),
borrowVenusApy: new BigNumber('4.543731091576054636'),
supplyVenusApr: new BigNumber('1.306740170918635611'),
supplyVenusApy: new BigNumber('1.606740170918635611'),
liquidity: new BigNumber('22080059.440703536158904017'),
tokenPrice: new BigNumber('30046.80414779'),
Expand Down Expand Up @@ -333,7 +347,9 @@ export const markets: Market[] = [
collateralFactor: '800000000000000000',
borrowApy: new BigNumber(-8.426578436066722),
supplyApy: new BigNumber('4.552151837121089047'),
borrowVenusApr: new BigNumber('0.194444965549789125'),
borrowVenusApy: new BigNumber('0.594444965549789125'),
supplyVenusApr: new BigNumber('0.163034531797658077'),
supplyVenusApy: new BigNumber('0.363034531797658077'),
liquidity: new BigNumber('9845948.33907734952053666'),
tokenPrice: new BigNumber('2216.20104621'),
Expand Down Expand Up @@ -376,7 +392,9 @@ export const markets: Market[] = [
collateralFactor: '600000000000000000',
borrowApy: new BigNumber(-3.1620166111983328),
supplyApy: new BigNumber('0.314789932511761432'),
borrowVenusApr: new BigNumber('6.470759902626424876'),
borrowVenusApy: new BigNumber('7.470759902626424876'),
supplyVenusApr: new BigNumber('0.511613513165150039'),
supplyVenusApy: new BigNumber('0.811613513165150039'),
liquidity: new BigNumber('10025195.90728602356972208'),
tokenPrice: new BigNumber('77.08032554'),
Expand Down Expand Up @@ -419,7 +437,9 @@ export const markets: Market[] = [
collateralFactor: '600000000000000000',
borrowApy: new BigNumber(-4.83745439850239),
supplyApy: new BigNumber('1.170702197010185572'),
borrowVenusApr: new BigNumber('3.103840954113091774'),
borrowVenusApy: new BigNumber('3.503840954113091774'),
supplyVenusApr: new BigNumber('0.547264218064808693'),
supplyVenusApy: new BigNumber('0.947264218064808693'),
liquidity: new BigNumber('7038696.186465025451091223'),
tokenPrice: new BigNumber('0.49118518'),
Expand Down Expand Up @@ -462,7 +482,9 @@ export const markets: Market[] = [
collateralFactor: '600000000000000000',
borrowApy: new BigNumber(-6.222291162175558),
supplyApy: new BigNumber('2.477129675383148568'),
borrowVenusApr: new BigNumber('0.354335409204269745'),
borrowVenusApy: new BigNumber('0.754335409204269745'),
supplyVenusApr: new BigNumber('0.105120518892226646'),
supplyVenusApy: new BigNumber('0.305120518892226646'),
liquidity: new BigNumber('6233328.035375996699870652'),
tokenPrice: new BigNumber('0.59959246'),
Expand Down Expand Up @@ -505,7 +527,9 @@ export const markets: Market[] = [
collateralFactor: '800000000000000000',
borrowApy: new BigNumber(-11.43143544764434),
supplyApy: new BigNumber('10.059455250632296701'),
borrowVenusApr: new BigNumber('1.120862854912494938'),
borrowVenusApy: new BigNumber('1.720862854912494938'),
supplyVenusApr: new BigNumber('1.122555082433944633'),
supplyVenusApy: new BigNumber('1.522555082433944633'),
liquidity: new BigNumber('126542.2480092636182555'),
tokenPrice: new BigNumber('0.10127635'),
Expand Down Expand Up @@ -548,7 +572,9 @@ export const markets: Market[] = [
collateralFactor: '600000000000000000',
borrowApy: new BigNumber(-3.3210326984806846),
supplyApy: new BigNumber('0.250490295580310715'),
borrowVenusApr: new BigNumber('0'),
borrowVenusApy: new BigNumber('0'),
supplyVenusApr: new BigNumber('0'),
supplyVenusApy: new BigNumber('0'),
liquidity: new BigNumber('1096504.17926256565752608'),
tokenPrice: new BigNumber('0.80243355'),
Expand Down Expand Up @@ -591,8 +617,10 @@ export const markets: Market[] = [
collateralFactor: '600000000000000000',
borrowApy: new BigNumber(-9.944536924720465),
supplyApy: new BigNumber('3.62333736102284998'),
borrowVenusApr: new BigNumber('0.06982533135294494'),
borrowVenusApy: new BigNumber('0.26982533135294494'),
supplyVenusApy: new BigNumber('0.134967169585684514'),
supplyVenusApr: new BigNumber('0.034967169585684514'),
liquidity: new BigNumber('12750279.070024119817464729'),
tokenPrice: new BigNumber('10.61421765'),
totalDistributed: '4473',
Expand Down Expand Up @@ -634,7 +662,9 @@ export const markets: Market[] = [
collateralFactor: '550000000000000000',
borrowApy: new BigNumber(-0.15634638954092597),
supplyApy: new BigNumber('0.001223666324407421'),
borrowVenusApr: new BigNumber('11.754861490074778241'),
borrowVenusApy: new BigNumber('14.754861490074778241'),
supplyVenusApr: new BigNumber('0.00787839946684478'),
supplyVenusApy: new BigNumber('0.10787839946684478'),
liquidity: new BigNumber('4198428.823994915665371422'),
tokenPrice: new BigNumber('399.24'),
Expand Down Expand Up @@ -677,7 +707,9 @@ export const markets: Market[] = [
collateralFactor: '800000000000000000',
borrowApy: new BigNumber(-0.000407488053549464),
supplyApy: new BigNumber('0.000000026208000003'),
borrowVenusApr: new BigNumber('100.564801757396621173'),
borrowVenusApy: new BigNumber('200.564801757396621173'),
supplyVenusApr: new BigNumber('0.001007365834885316'),
supplyVenusApy: new BigNumber('0.009007365834885316'),
liquidity: new BigNumber('101302248.124545613039422944'),
tokenPrice: new BigNumber('1'),
Expand Down Expand Up @@ -720,7 +752,9 @@ export const markets: Market[] = [
collateralFactor: '600000000000000000',
borrowApy: new BigNumber(-2.025978773806436),
supplyApy: new BigNumber('0.001208241156882074'),
borrowVenusApr: new BigNumber('6102.522495213142034502'),
borrowVenusApy: new BigNumber('8102.522495213142034502'),
supplyVenusApr: new BigNumber('0.134415260865180737'),
supplyVenusApy: new BigNumber('0.334415260865180737'),
liquidity: new BigNumber('2731134.739119160849766471'),
tokenPrice: new BigNumber('1'),
Expand Down Expand Up @@ -763,7 +797,9 @@ export const markets: Market[] = [
collateralFactor: '800000000000000000',
borrowApy: new BigNumber(-0.03324775882974874),
supplyApy: new BigNumber('0.000177293083452232'),
borrowVenusApr: new BigNumber('13422868925129157708929136429307036907.51510720619883895'),
borrowVenusApy: new BigNumber('23422868925129157708929136429307036907.51510720619883895'),
supplyVenusApr: new BigNumber('53.636157517717037851'),
supplyVenusApy: new BigNumber('83.636157517717037851'),
liquidity: new BigNumber('14900.999999998926001055'),
tokenPrice: new BigNumber('1'),
Expand Down Expand Up @@ -806,8 +842,10 @@ export const markets: Market[] = [
collateralFactor: '550000000000000000',
borrowApy: new BigNumber(-2.014488268288307),
supplyApy: new BigNumber('0'),
borrowVenusApy: new BigNumber('Infinity'),
supplyVenusApy: new BigNumber('1841951.587706392698558375'),
borrowVenusApr: new BigNumber('1.187706392698558375'),
borrowVenusApy: new BigNumber('1.587706392698558375'),
supplyVenusApr: new BigNumber('16.587706392698558375'),
supplyVenusApy: new BigNumber('18.587706392698558375'),
liquidity: new BigNumber('1375'),
tokenPrice: new BigNumber('1'),
totalDistributed: '473',
Expand Down
30 changes: 30 additions & 0 deletions src/__mocks__/models/pools.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Pool } from 'types';

import { assetData } from '__mocks__/models/asset';

export const poolData: Pool[] = [
{
id: '1',
assets: assetData,
name: 'Venus',
riskLevel: 'MINIMAL',
description: 'Fake description 1',
isIsolated: false,
},
{
id: '2',
assets: assetData,
name: 'Metaverse',
riskLevel: 'VERY_HIGH',
description: 'Fake description 2',
isIsolated: true,
},
{
id: '3',
assets: assetData,
name: 'Gaming',
riskLevel: 'MEDIUM',
description: 'Fake description 3',
isIsolated: true,
},
];
5 changes: 5 additions & 0 deletions src/clients/api/queries/getMarkets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ const getMarkets = async (): Promise<GetMarketsOutput> => {
if ('result' in response && response.result === 'error') {
throw new Error(response.message);
}

let markets: Market[] = [];
let dailyVenusWei;

if (response && response.data && response.data.data) {
dailyVenusWei = new BigNumber(response.data.data.dailyVenus);
markets = Object.keys(VBEP_TOKENS).reduce<Market[]>((acc: Market[], curr: string) => {
Expand All @@ -39,7 +41,9 @@ const getMarkets = async (): Promise<GetMarketsOutput> => {
tokenPrice: new BigNumber(activeMarket.tokenPrice),
liquidity: new BigNumber(activeMarket.liquidity),
borrowVenusApy: new BigNumber(activeMarket.borrowVenusApy),
borrowVenusApr: new BigNumber(activeMarket.borrowVenusApr),
borrowApy: new BigNumber(activeMarket.borrowApy),
supplyVenusApr: new BigNumber(activeMarket.supplyVenusApr),
supplyVenusApy: new BigNumber(activeMarket.supplyVenusApy),
supplyApy: new BigNumber(activeMarket.supplyApy),
treasuryTotalBorrowsCents: new BigNumber(activeMarket.totalBorrowsUsd).times(100),
Expand All @@ -50,6 +54,7 @@ const getMarkets = async (): Promise<GetMarketsOutput> => {
return acc;
}, []);
}

return { markets, dailyVenusWei };
};

Expand Down
Loading

0 comments on commit d88b195

Please sign in to comment.