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

Commit

Permalink
fix: Minor fixes (#750)
Browse files Browse the repository at this point in the history
* fix: removed prefix on Euler's position APY

* fix: dfx's position logos

* fix: hide llama-airforce airdrop in explorer

* added liquidity to xsSolace's position + enabled TVL

* fix: enabled yearn governance TVL
  • Loading branch information
wpoulin authored Jun 24, 2022
1 parent 5236330 commit 2450167
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/apps/dfx/ethereum/dfx.curve.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import _ from 'lodash';
import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface';
import { Register } from '~app-toolkit/decorators';
import { buildDollarDisplayItem } from '~app-toolkit/helpers/presentation/display-item.present';
import { getAppImg } from '~app-toolkit/helpers/presentation/image.present';
import { getImagesFromToken } from '~app-toolkit/helpers/presentation/image.present';
import { ContractType } from '~position/contract.interface';
import { PositionFetcher } from '~position/position-fetcher.interface';
import { AppTokenPosition } from '~position/position.interface';
Expand Down Expand Up @@ -76,7 +76,7 @@ export class EthereumDfxCurveTokenFetcher implements PositionFetcher<AppTokenPos
const [, baseToken, quoteToken] = name.split('-');
const label = `${baseToken.toUpperCase()}/${quoteToken.toUpperCase()}`;
const secondaryLabel = buildDollarDisplayItem(price);
const images = [getAppImg(appId)];
const images = tokens.map(v => getImagesFromToken(v)).flat();

// Create token object
const lpToken: AppTokenPosition = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class EthereumDfxStakingContractPositionFetcher implements PositionFetche

// Prepare display props
const label = getLabelFromToken(stakedToken);
const images = getImagesFromToken(stakedToken);
const images = tokens.map(v => getImagesFromToken(v)).flat();
const secondaryLabel = buildDollarDisplayItem(stakedToken.price);
const statsItems = [{ label: 'Liquidity', value: buildDollarDisplayItem(liquidity) }];

Expand Down
4 changes: 2 additions & 2 deletions src/apps/dfx/polygon/dfx.curve.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import _ from 'lodash';
import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface';
import { Register } from '~app-toolkit/decorators';
import { buildDollarDisplayItem } from '~app-toolkit/helpers/presentation/display-item.present';
import { getAppImg } from '~app-toolkit/helpers/presentation/image.present';
import { getImagesFromToken } from '~app-toolkit/helpers/presentation/image.present';
import { ContractType } from '~position/contract.interface';
import { PositionFetcher } from '~position/position-fetcher.interface';
import { AppTokenPosition } from '~position/position.interface';
Expand Down Expand Up @@ -76,7 +76,7 @@ export class PolygonDfxCurveTokenFetcher implements PositionFetcher<AppTokenPosi
const [, baseToken, quoteToken] = name.split('-');
const label = `${baseToken.toUpperCase()}/${quoteToken.toUpperCase()}`;
const secondaryLabel = buildDollarDisplayItem(price);
const images = [getAppImg(appId)];
const images = tokens.map(v => getImagesFromToken(v)).flat();

// Create token object
const lpToken: AppTokenPosition = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class PolygonDfxStakingContractPositionFetcher implements PositionFetcher

// Prepare display props
const label = getLabelFromToken(stakedToken);
const images = getImagesFromToken(stakedToken);
const images = tokens.map(v => getImagesFromToken(v)).flat();
const secondaryLabel = buildDollarDisplayItem(stakedToken.price);
const statsItems = [{ label: 'Liquidity', value: buildDollarDisplayItem(liquidity) }];

Expand Down
2 changes: 1 addition & 1 deletion src/apps/euler/ethereum/euler.d-token.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class EthereumEulerDTokenTokenFetcher implements PositionFetcher<AppToken
value: buildDollarDisplayItem(liquidity),
},
{
label: 'Borrow APY',
label: 'APY',
value: buildPercentageDisplayItem(borrowAPY),
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/apps/euler/ethereum/euler.e-token.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class EthereumEulerETokenTokenFetcher implements PositionFetcher<AppToken
value: buildDollarDisplayItem(liquidity),
},
{
label: 'Supply APY',
label: 'APY',
value: buildPercentageDisplayItem(supplyAPY),
},
];
Expand Down
1 change: 1 addition & 0 deletions src/apps/llama-airforce/llama-airforce.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const LLAMA_AIRFORCE_DEFINITION = appDefinition({
id: 'airdrop',
type: GroupType.TOKEN,
label: 'Airdrop',
isHiddenFromExplore: true,
},
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { Inject } from '@nestjs/common';

import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface';
import { Register } from '~app-toolkit/decorators';
import { buildDollarDisplayItem } from '~app-toolkit/helpers/presentation/display-item.present';
import { getImagesFromToken } from '~app-toolkit/helpers/presentation/image.present';
import { ContractType } from '~position/contract.interface';
import { PositionFetcher } from '~position/position-fetcher.interface';
import { ContractPosition } from '~position/position.interface';
import { claimable, supplied } from '~position/position.utils';
import { Network } from '~types/network.interface';

import { SolaceContractFactory } from '../contracts';
import { SOLACE_DEFINITION } from '../solace.definition';

const appId = SOLACE_DEFINITION.id;
Expand All @@ -18,26 +20,42 @@ const network = Network.ETHEREUM_MAINNET;
const SOLACE_ADDRESS = '0x501ace9c35e60f03a2af4d484f49f9b1efde9f40';
const XSLOCKER_ADDRESS = '0x501ace47c5b0c2099c4464f681c3fa2ecd3146c1';

@Register.ContractPositionFetcher({ appId, groupId, network })
@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class EthereumSolaceXslockerContractPositionFetcher implements PositionFetcher<ContractPosition> {
constructor(@Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit) {}
constructor(
@Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit,
@Inject(SolaceContractFactory) private readonly solaceContractFactory: SolaceContractFactory,
) {}

async getPositions() {
const multicall = this.appToolkit.getMulticall(network);
const baseTokens = await this.appToolkit.getBaseTokenPrices(network);
const solace = baseTokens.find(t => t.address === SOLACE_ADDRESS)!;
if (!solace) return [];

const solaceTokenContract = this.solaceContractFactory.erc20({ address: SOLACE_ADDRESS, network });
const [balanceOfRaw, decimals] = await Promise.all([
multicall.wrap(solaceTokenContract).balanceOf(XSLOCKER_ADDRESS),
multicall.wrap(solaceTokenContract).decimals(),
]);

const balanceOf = Number(balanceOfRaw) / 10 ** decimals;
const liquidity = balanceOf * solace.price;

const position: ContractPosition = {
type: ContractType.POSITION,
address: XSLOCKER_ADDRESS,
appId,
groupId,
network,
tokens: [supplied(solace), claimable(solace)],
dataProps: {},
dataProps: {
liquidity,
},
displayProps: {
label: `xsLOCK`,
images: getImagesFromToken(solace),
statsItems: [{ label: 'Liquidity', value: buildDollarDisplayItem(liquidity) }],
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const appId = YEARN_DEFINITION.id;
const groupId = YEARN_DEFINITION.groups.governance.id;
const network = Network.ETHEREUM_MAINNET;

@Register.ContractPositionFetcher({ appId, groupId, network })
@Register.ContractPositionFetcher({ appId, groupId, network, options: { includeInTvl: true } })
export class EthereumYearnGovernanceContractPositionFetcher implements PositionFetcher<ContractPosition> {
constructor(
@Inject(APP_TOOLKIT)
Expand Down

0 comments on commit 2450167

Please sign in to comment.