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

Commit

Permalink
plutus: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tonzgao committed May 23, 2022
1 parent 17bcb9a commit 69b7d47
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/apps/plutus/arbitrum/plutus.balance-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Network } from '~types/network.interface';

import {
PlutusContractFactory,
MasterChef,
PlsPlutusChef,
PlsDpxPlutusChef,
PlsJonesPlutusChef,
PlutusEpochStaking,
Expand Down Expand Up @@ -99,12 +99,12 @@ export class ArbitrumPlutusBalanceFetcher implements BalanceFetcher {
}

async getStakedPlsBalances(address: string) {
return this.appToolkit.helpers.singleStakingContractPositionBalanceHelper.getBalances<MasterChef>({
return this.appToolkit.helpers.singleStakingContractPositionBalanceHelper.getBalances<PlsPlutusChef>({
address,
network,
appId,
groupId: PLUTUS_DEFINITION.groups.stake.id,
resolveContract: ({ address, network }) => this.contractFactory.masterChef({ address, network }),
resolveContract: ({ address, network }) => this.contractFactory.plsPlutusChef({ address, network }),
resolveStakedTokenBalance: async ({ contract, address, multicall }) => {
const pool = Number(await multicall.wrap(contract).poolLength()) - 1;
return await multicall
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { PositionFetcher } from '~position/position-fetcher.interface';
import { ContractPosition } from '~position/position.interface';
import { Network } from '~types/network.interface';

import { PlutusContractFactory, MasterChef } from '../contracts';
import { PlutusContractFactory, PlsPlutusChef } from '../contracts';
import { PLUTUS_DEFINITION } from '../plutus.definition';

import { VAULTS, ADDRESSES } from './consts';
Expand All @@ -23,7 +23,7 @@ export class ArbitrumPlutusStakeContractPositionFetcher implements PositionFetch
) {}

async getPositions() {
return this.appToolkit.helpers.singleStakingFarmContractPositionHelper.getContractPositions<MasterChef>({
return this.appToolkit.helpers.singleStakingFarmContractPositionHelper.getContractPositions<PlsPlutusChef>({
appId,
groupId,
network,
Expand All @@ -36,7 +36,7 @@ export class ArbitrumPlutusStakeContractPositionFetcher implements PositionFetch
.poolInfo(pool)
.then(info => info.lpToken);
},
resolveFarmContract: opts => this.contractFactory.masterChef(opts),
resolveFarmContract: opts => this.contractFactory.plsPlutusChef(opts),
resolveRewardTokenAddresses: async () => ADDRESSES.pls,
resolveRois: () => ({ dailyROI: 0, weeklyROI: 0, yearlyROI: 0 }),
});
Expand Down
2 changes: 2 additions & 0 deletions src/apps/plutus/arbitrum/plutus.ve.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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';
Expand Down Expand Up @@ -49,6 +50,7 @@ export class ArbitrumPlutusVeTokenFetcher implements PositionFetcher<AppTokenPos
dataProps: {},
displayProps: {
label: symbol,
secondaryLabel: buildDollarDisplayItem(price),
images: getImagesFromToken(baseToken),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi
import type { Listener, Provider } from '@ethersproject/providers';
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common';

export interface MasterChefInterface extends utils.Interface {
export interface PlsPlutusChefInterface extends utils.Interface {
functions: {
'MONTH_IN_SECONDS()': FunctionFragment;
'PLS()': FunctionFragment;
Expand Down Expand Up @@ -165,12 +165,12 @@ export type WithdrawEvent = TypedEvent<[string, BigNumber, BigNumber], WithdrawE

export type WithdrawEventFilter = TypedEventFilter<WithdrawEvent>;

export interface MasterChef extends BaseContract {
export interface PlsPlutusChef extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;

interface: MasterChefInterface;
interface: PlsPlutusChefInterface;

queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { Contract, Signer, utils } from 'ethers';
import type { Provider } from '@ethersproject/providers';
import type { MasterChef, MasterChefInterface } from '../MasterChef';
import type { PlsPlutusChef, PlsPlutusChefInterface } from '../PlsPlutusChef';

const _abi = [
{
Expand Down Expand Up @@ -485,12 +485,12 @@ const _abi = [
},
];

export class MasterChef__factory {
export class PlsPlutusChef__factory {
static readonly abi = _abi;
static createInterface(): MasterChefInterface {
return new utils.Interface(_abi) as MasterChefInterface;
static createInterface(): PlsPlutusChefInterface {
return new utils.Interface(_abi) as PlsPlutusChefInterface;
}
static connect(address: string, signerOrProvider: Signer | Provider): MasterChef {
return new Contract(address, _abi, signerOrProvider) as MasterChef;
static connect(address: string, signerOrProvider: Signer | Provider): PlsPlutusChef {
return new Contract(address, _abi, signerOrProvider) as PlsPlutusChef;
}
}
2 changes: 1 addition & 1 deletion src/apps/plutus/contracts/ethers/factories/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export { MasterChef__factory } from './MasterChef__factory';
export { PlsDpxPlutusChef__factory } from './PlsDpxPlutusChef__factory';
export { PlsJonesPlutusChef__factory } from './PlsJonesPlutusChef__factory';
export { PlsPlutusChef__factory } from './PlsPlutusChef__factory';
export { PlutusEpochStaking__factory } from './PlutusEpochStaking__factory';
4 changes: 2 additions & 2 deletions src/apps/plutus/contracts/ethers/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export type { MasterChef } from './MasterChef';
export type { PlsDpxPlutusChef } from './PlsDpxPlutusChef';
export type { PlsJonesPlutusChef } from './PlsJonesPlutusChef';
export type { PlsPlutusChef } from './PlsPlutusChef';
export type { PlutusEpochStaking } from './PlutusEpochStaking';
export * as factories from './factories';
export { MasterChef__factory } from './factories/MasterChef__factory';
export { PlsDpxPlutusChef__factory } from './factories/PlsDpxPlutusChef__factory';
export { PlsJonesPlutusChef__factory } from './factories/PlsJonesPlutusChef__factory';
export { PlsPlutusChef__factory } from './factories/PlsPlutusChef__factory';
export { PlutusEpochStaking__factory } from './factories/PlutusEpochStaking__factory';
10 changes: 5 additions & 5 deletions src/apps/plutus/contracts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface';
import { ContractFactory } from '~contract/contracts';
import { Network } from '~types/network.interface';

import { MasterChef__factory } from './ethers';
import { PlsDpxPlutusChef__factory } from './ethers';
import { PlsJonesPlutusChef__factory } from './ethers';
import { PlsPlutusChef__factory } from './ethers';
import { PlutusEpochStaking__factory } from './ethers';

// eslint-disable-next-line
Expand All @@ -18,21 +18,21 @@ export class PlutusContractFactory extends ContractFactory {
super((network: Network) => appToolkit.getNetworkProvider(network));
}

masterChef({ address, network }: ContractOpts) {
return MasterChef__factory.connect(address, this.appToolkit.getNetworkProvider(network));
}
plsDpxPlutusChef({ address, network }: ContractOpts) {
return PlsDpxPlutusChef__factory.connect(address, this.appToolkit.getNetworkProvider(network));
}
plsJonesPlutusChef({ address, network }: ContractOpts) {
return PlsJonesPlutusChef__factory.connect(address, this.appToolkit.getNetworkProvider(network));
}
plsPlutusChef({ address, network }: ContractOpts) {
return PlsPlutusChef__factory.connect(address, this.appToolkit.getNetworkProvider(network));
}
plutusEpochStaking({ address, network }: ContractOpts) {
return PlutusEpochStaking__factory.connect(address, this.appToolkit.getNetworkProvider(network));
}
}

export type { MasterChef } from './ethers';
export type { PlsDpxPlutusChef } from './ethers';
export type { PlsJonesPlutusChef } from './ethers';
export type { PlsPlutusChef } from './ethers';
export type { PlutusEpochStaking } from './ethers';

0 comments on commit 69b7d47

Please sign in to comment.