Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-groups-dig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@venusprotocol/evm": minor
---

add group logic to E-mode
8 changes: 8 additions & 0 deletions apps/evm/src/__mocks__/models/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const assetData: Asset[] = [
badDebtMantissa: 6789000000000000000n,
supplierCount: 100,
borrowerCount: 10,
isBorrowable: true,
isBorrowableByUser: true,
exchangeRateVTokens: new BigNumber(49.589181233),
userWalletBalanceTokens: new BigNumber('100'),
userWalletBalanceCents: new BigNumber('12786'),
Expand Down Expand Up @@ -92,6 +94,8 @@ export const assetData: Asset[] = [
badDebtMantissa: 0n,
supplierCount: 100,
borrowerCount: 10,
isBorrowable: false,
isBorrowableByUser: false,
exchangeRateVTokens: new BigNumber(1),
userWalletBalanceTokens: new BigNumber('0'),
userWalletBalanceCents: new BigNumber('0'),
Expand Down Expand Up @@ -179,6 +183,8 @@ export const assetData: Asset[] = [
badDebtMantissa: 0n,
supplierCount: 100,
borrowerCount: 10,
isBorrowable: true,
isBorrowableByUser: true,
exchangeRateVTokens: new BigNumber(0.981982),
userWalletBalanceTokens: new BigNumber('900'),
userWalletBalanceCents: new BigNumber('90000'),
Expand Down Expand Up @@ -262,6 +268,8 @@ export const assetData: Asset[] = [
badDebtMantissa: 0n,
supplierCount: 100,
borrowerCount: 10,
isBorrowable: true,
isBorrowableByUser: true,
exchangeRateVTokens: new BigNumber(1.000003),
userWalletBalanceTokens: new BigNumber('110'),
userWalletBalanceCents: new BigNumber('11000'),
Expand Down
8 changes: 2 additions & 6 deletions apps/evm/src/__mocks__/models/eModeGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,34 @@ const generateEModeGroup = ({
groupAssets,
id,
name,
description,
}: { groupAssets: Asset[]; id: number; name: string; description: string }) => ({
}: { groupAssets: Asset[]; id: number; name: string }): EModeGroup => ({
id,
name,
description,
assetSettings: groupAssets.map(a => ({
vToken: a.vToken,
collateralFactor: a.userCollateralFactor + 0.1,
liquidationThresholdPercentage: a.userLiquidationThresholdPercentage + 12,
liquidationPenaltyPercentage: a.userLiquidationThresholdPercentage - 50,
liquidityCents: a.liquidityCents.toNumber(),
liquidityTokens: a.cashTokens,
isBorrowable: a.isBorrowable,
})),
});

export const eModeGroups: EModeGroup[] = [
generateEModeGroup({
id: 0,
name: 'Stablecoins',
description: 'This block contains the assets of this category',
groupAssets: assetData.slice(0, 3),
}),
generateEModeGroup({
id: 1,
name: 'DeFi',
description: 'This block contains the assets of this category',
groupAssets: assetData.slice(2, 4),
}),
generateEModeGroup({
id: 2,
name: '#ToTheMoon',
description: 'This block contains the assets of this category',
groupAssets: assetData.slice(5, 8),
}),
];
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ exports[`useGetAsset > returns the correct asset 1`] = `
"collateralFactor": 0.5,
"disabledTokenActions": [],
"exchangeRateVTokens": "49.589181233",
"isBorrowable": true,
"isBorrowableByUser": true,
"isCollateralOfUser": true,
"liquidationThresholdPercentage": 50,
"liquidityCents": "8036465875",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ exports[`useGetPool > returns the correct asset 1`] = `
"collateralFactor": 0.5,
"disabledTokenActions": [],
"exchangeRateVTokens": "49.589181233",
"isBorrowable": true,
"isBorrowableByUser": true,
"isCollateralOfUser": true,
"liquidationThresholdPercentage": 50,
"liquidityCents": "8036465875",
Expand Down Expand Up @@ -149,6 +151,8 @@ exports[`useGetPool > returns the correct asset 1`] = `
"supply",
],
"exchangeRateVTokens": "1",
"isBorrowable": false,
"isBorrowableByUser": false,
"isCollateralOfUser": false,
"liquidationThresholdPercentage": 80,
"liquidityCents": "1702951959",
Expand Down Expand Up @@ -275,6 +279,8 @@ exports[`useGetPool > returns the correct asset 1`] = `
"swapAndSupply",
],
"exchangeRateVTokens": "0.981982",
"isBorrowable": true,
"isBorrowableByUser": true,
"isCollateralOfUser": false,
"liquidationThresholdPercentage": 80,
"liquidityCents": "5534102886",
Expand Down Expand Up @@ -393,6 +399,8 @@ exports[`useGetPool > returns the correct asset 1`] = `
"supply",
],
"exchangeRateVTokens": "1.000003",
"isBorrowable": true,
"isBorrowableByUser": true,
"isCollateralOfUser": false,
"liquidationThresholdPercentage": 80,
"liquidityCents": "3654492935",
Expand Down Expand Up @@ -482,6 +490,7 @@ exports[`useGetPool > returns the correct asset 1`] = `
"assetSettings": [
{
"collateralFactor": 0.6,
"isBorrowable": true,
"liquidationPenaltyPercentage": 0,
"liquidationThresholdPercentage": 62,
"liquidityCents": 8036465875,
Expand All @@ -500,6 +509,7 @@ exports[`useGetPool > returns the correct asset 1`] = `
},
{
"collateralFactor": 0.9,
"isBorrowable": false,
"liquidationPenaltyPercentage": 30,
"liquidationThresholdPercentage": 92,
"liquidityCents": 1702951959,
Expand All @@ -518,6 +528,7 @@ exports[`useGetPool > returns the correct asset 1`] = `
},
{
"collateralFactor": 0.9,
"isBorrowable": true,
"liquidationPenaltyPercentage": 30,
"liquidationThresholdPercentage": 92,
"liquidityCents": 5534102886,
Expand All @@ -535,14 +546,14 @@ exports[`useGetPool > returns the correct asset 1`] = `
},
},
],
"description": "This block contains the assets of this category",
"id": 0,
"name": "Stablecoins",
},
{
"assetSettings": [
{
"collateralFactor": 0.9,
"isBorrowable": true,
"liquidationPenaltyPercentage": 30,
"liquidationThresholdPercentage": 92,
"liquidityCents": 5534102886,
Expand All @@ -561,6 +572,7 @@ exports[`useGetPool > returns the correct asset 1`] = `
},
{
"collateralFactor": 0.9,
"isBorrowable": true,
"liquidationPenaltyPercentage": 30,
"liquidationThresholdPercentage": 92,
"liquidityCents": 3654492935,
Expand All @@ -578,13 +590,11 @@ exports[`useGetPool > returns the correct asset 1`] = `
},
},
],
"description": "This block contains the assets of this category",
"id": 1,
"name": "DeFi",
},
{
"assetSettings": [],
"description": "This block contains the assets of this category",
"id": 2,
"name": "#ToTheMoon",
},
Expand Down
Loading