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

Commit

Permalink
fix: update polynomial vault name (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonzgao authored May 22, 2022
1 parent 5588946 commit c6533b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export type SingleStakingFarmContractPositionHelperParams<T> = {
network: Network;
}) => SingleStakingFarmDefinition[] | Promise<SingleStakingFarmDefinition[]>;
resolveImplementation?: () => string;
resolveLabel?: (definition: string | SingleStakingFarmDefinition) => string;
resolveFarmAddresses?: (opts: { network: Network }) => (string | null)[] | Promise<(string | null)[]>;
resolveStakedTokenAddress?: (opts: { contract: T; multicall: Multicall; index: number }) => Promise<string>;
resolveRewardTokenAddresses?: (opts: { contract: T; multicall: Multicall }) => Promise<string | string[]>;
Expand All @@ -98,6 +99,7 @@ export class SingleStakingFarmContractPositionHelper {
resolveFarmAddresses,
resolveFarmDefinitions,
resolveImplementation,
resolveLabel,
resolveStakedTokenAddress = async () => '',
resolveRewardTokenAddresses = async () => [],
resolveIsActive = async () => true,
Expand Down Expand Up @@ -197,7 +199,7 @@ export class SingleStakingFarmContractPositionHelper {
// Display Properties
const underlyingLabel =
stakedToken.type === ContractType.APP_TOKEN ? stakedToken.displayProps.label : stakedToken.symbol;
const label = `Staked ${underlyingLabel}`;
const label = resolveLabel ? resolveLabel(definitionOrAddress) : `Staked ${underlyingLabel}`;
const secondaryLabel = buildDollarDisplayItem(stakedToken.price);
const images = [getTokenImg(stakedToken.address, network)];
const statsItems = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Inject } from '@nestjs/common';
import Axios from 'axios';
import _ from 'lodash';

import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface';
import { Register } from '~app-toolkit/decorators';
Expand All @@ -14,6 +15,8 @@ const appId = POLYNOMIAL_DEFINITION.id;
const groupId = POLYNOMIAL_DEFINITION.groups.vaults.id;
const network = Network.OPTIMISM_MAINNET;

const resolveTitle = (title: string) => _.startCase(_.toLower(title));

@Register.ContractPositionFetcher({ appId, groupId, network })
export class OptimismPolynomialVaultsContractPositionFetcher implements PositionFetcher<ContractPosition> {
constructor(
Expand All @@ -36,6 +39,8 @@ export class OptimismPolynomialVaultsContractPositionFetcher implements Position
resolveStakedTokenAddress: async ({ multicall, contract }) => multicall.wrap(contract).UNDERLYING(),
resolveFarmContract: ({ address }) => this.contractFactory.polynomialCoveredCall({ address, network }),
resolveTotalValueLocked: ({ multicall, contract }) => multicall.wrap(contract).totalFunds(),
resolveLabel: address =>
resolveTitle(vaults.find(vault => vault.contractAddress.toLowerCase() === address).type),
resolveRois: () => ({
dailyROI: 0,
weeklyROI: 0,
Expand All @@ -54,6 +59,8 @@ export class OptimismPolynomialVaultsContractPositionFetcher implements Position
resolveStakedTokenAddress: async ({ multicall, contract }) => multicall.wrap(contract).COLLATERAL(),
resolveFarmContract: ({ address }) => this.contractFactory.polynomialPutSelling({ address, network }),
resolveTotalValueLocked: ({ multicall, contract }) => multicall.wrap(contract).totalFunds(),
resolveLabel: address =>
resolveTitle(vaults.find(vault => vault.contractAddress.toLowerCase() === address).type),
resolveRois: () => ({
dailyROI: 0,
weeklyROI: 0,
Expand Down

0 comments on commit c6533b6

Please sign in to comment.