Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

feat(bastion): Add presentation config, fix displayed APY and remove custom tvl fetcher #740

Merged
merged 1 commit into from
Jun 23, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const appId = BASTION_PROTOCOL_DEFINITION.id;
const groupId = BASTION_PROTOCOL_DEFINITION.groups.borrow.id;
const network = Network.AURORA_MAINNET;

@Register.ContractPositionFetcher({ appId, groupId, network })
@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class AuroraBastionProtocolBorrowContractPositionFetcher implements PositionFetcher<ContractPosition> {
constructor(
@Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit,
Expand Down Expand Up @@ -69,14 +69,14 @@ export class AuroraBastionProtocolBorrowContractPositionFetcher implements Posit
const borrowApy = appToken.dataProps.borrowApy;

// Display Props
const label = `Borrowed ${getLabelFromToken(appToken.tokens[0])}`;
const label = `${getLabelFromToken(appToken.tokens[0])}`;
const secondaryLabel = buildDollarDisplayItem(underlyingPrice);
const tertiaryLabel = isNumber(borrowApy) ? `${(borrowApy * 100).toFixed(3)}% APR` : '';
const images = appToken.displayProps.images;
const statsItems = isNumber(borrowApy)
? [
{ label: 'Borrow APR', value: buildPercentageDisplayItem(borrowApy) },
{ label: 'Liquidity', value: buildDollarDisplayItem(dataProps.liquidity) },
{ label: 'APY', value: buildPercentageDisplayItem(borrowApy * 100) },
{ label: 'Liquidity', value: buildDollarDisplayItem(borrowLiquidity) },
]
: [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const appId = BASTION_PROTOCOL_DEFINITION.id;
const groupId = BASTION_PROTOCOL_DEFINITION.groups.supply.id;
const network = Network.AURORA_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class AuroraBastionProtocolSupplyTokenFetcher implements PositionFetcher<AppTokenPosition> {
constructor(@Inject(BastionSupplyTokenHelper) private readonly bastionSupplyTokenHelper: BastionSupplyTokenHelper) {}
async getPositions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const appId = BASTION_PROTOCOL_DEFINITION.id;
const groupId = BASTION_PROTOCOL_DEFINITION.groups.swap.id;
const network = Network.AURORA_MAINNET;

@Register.TokenPositionFetcher({ appId, groupId, network })
@Register.TokenPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class AuroraBastionProtocolSwapTokenFetcher implements PositionFetcher<AppTokenPosition> {
constructor(
@Inject(CurvePoolTokenHelper) private readonly curvePoolTokenHelper: CurvePoolTokenHelper,
Expand Down
33 changes: 0 additions & 33 deletions src/apps/bastion-protocol/aurora/bastion-protocol.tvl-fetcher.ts

This file was deleted.

28 changes: 25 additions & 3 deletions src/apps/bastion-protocol/bastion-protocol.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export const BASTION_PROTOCOL_DEFINITION = appDefinition({
supply: {
id: 'supply',
type: GroupType.TOKEN,
label: 'Supply',
label: 'Lending',
groupLabel: 'Supply',
},

borrow: {
id: 'borrow',
type: GroupType.TOKEN,
label: 'Borrow',
label: 'Lending',
groupLabel: 'Borrow',
},

swap: {
Expand All @@ -28,7 +30,27 @@ export const BASTION_PROTOCOL_DEFINITION = appDefinition({
label: 'Stableswap Pools',
},
},

presentationConfig: {
tabs: [
{
label: 'Lending',
viewType: 'split',
views: [
{
viewType: 'list',
label: 'Supply',
groupIds: ['supply'],
},
{
viewType: 'list',
label: 'Borrow',
groupIds: ['borrow'],
},
],
},
{ label: 'Stableswap Pools', viewType: 'list', groupIds: ['swap'] },
],
},
tags: [AppTag.LENDING, AppTag.LIQUIDITY_POOL],
keywords: [],
links: {},
Expand Down
2 changes: 0 additions & 2 deletions src/apps/bastion-protocol/bastion-protocol.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { AuroraBastionProtocolBalanceFetcher } from './aurora/bastion-protocol.b
import { AuroraBastionProtocolBorrowContractPositionFetcher } from './aurora/bastion-protocol.borrow.contract-position-fetcher';
import { AuroraBastionProtocolSupplyTokenFetcher } from './aurora/bastion-protocol.supply.token-fetcher';
import { AuroraBastionProtocolSwapTokenFetcher } from './aurora/bastion-protocol.swap.token-fetcher';
import { AuroraBastionProtocolTvlFetcher } from './aurora/bastion-protocol.tvl-fetcher';
import { BastionProtocolAppDefinition, BASTION_PROTOCOL_DEFINITION } from './bastion-protocol.definition';
import { BastionProtocolContractFactory } from './contracts';
import { BastionSupplyTokenHelper } from './helper/bastion-protocol.supply.token-helper';
Expand All @@ -18,7 +17,6 @@ import { BastionSupplyTokenHelper } from './helper/bastion-protocol.supply.token
AuroraBastionProtocolBorrowContractPositionFetcher,
AuroraBastionProtocolSupplyTokenFetcher,
AuroraBastionProtocolSwapTokenFetcher,
AuroraBastionProtocolTvlFetcher,
BastionProtocolAppDefinition,
BastionProtocolContractFactory,
BastionSupplyTokenHelper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class BastionSupplyTokenHelper {
const images = [getTokenImg(underlyingToken.address, network)];
const balanceDisplayMode = BalanceDisplayMode.UNDERLYING;
const statsItems = [
{ label: 'Supply APY', value: buildPercentageDisplayItem(supplyApy) },
{ label: 'APY', value: buildPercentageDisplayItem(supplyApy * 100) },
{ label: 'Liquidity', value: buildDollarDisplayItem(liquidity) },
];

Expand Down