diff --git a/src/apps/curve/common/curve.child-liquidity-gauge.contract-position-fetcher.ts b/src/apps/curve/common/curve.child-liquidity-gauge.contract-position-fetcher.ts index e6aa96c50..0874b7ab4 100644 --- a/src/apps/curve/common/curve.child-liquidity-gauge.contract-position-fetcher.ts +++ b/src/apps/curve/common/curve.child-liquidity-gauge.contract-position-fetcher.ts @@ -4,7 +4,7 @@ import { Inject } from '@nestjs/common'; import BigNumber from 'bignumber.js'; import { BigNumberish } from 'ethers'; import { range, sum } from 'lodash'; -import moment from 'moment'; +import { duration } from 'moment'; import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; import { ZERO_ADDRESS } from '~app-toolkit/constants/address'; @@ -110,12 +110,12 @@ export abstract class CurveChildLiquidityGaugeContractPositionFetcher extends Co // Calculate annual CRV rewards const period = await contract.read.period(); const periodTimestamp = await contract.read.period_timestamp([period]); - const periodWeek = Math.floor(Number(periodTimestamp) / moment.duration(7, 'days').asSeconds()); // num weeks + const periodWeek = Math.floor(Number(periodTimestamp) / duration(7, 'days').asSeconds()); // num weeks const crvToken = rewardTokens.find(v => v.address === this.crvTokenAddress)!; const crvInflationRateRaw = await contract.read.inflation_rate([BigInt(periodWeek)]); const crvInflationRate = Number(crvInflationRateRaw) / 10 ** crvToken.decimals; - const crvYearlyReward = crvInflationRate * moment.duration(1, 'year').asSeconds(); + const crvYearlyReward = crvInflationRate * duration(1, 'year').asSeconds(); const crvYearlyRewardInUSD = crvYearlyReward * crvToken.price; // Calculate annual bonus rewards diff --git a/src/apps/curve/common/curve.pool-gauge.contract-position-fetcher.ts b/src/apps/curve/common/curve.pool-gauge.contract-position-fetcher.ts index 3c972f4f1..4bb903f65 100644 --- a/src/apps/curve/common/curve.pool-gauge.contract-position-fetcher.ts +++ b/src/apps/curve/common/curve.pool-gauge.contract-position-fetcher.ts @@ -1,7 +1,7 @@ import { Inject } from '@nestjs/common'; import { BigNumber, BigNumberish, ethers } from 'ethers'; import { range } from 'lodash'; -import moment from 'moment'; +import { duration } from 'moment'; import { Abi, GetContractReturnType, PublicClient } from 'viem'; import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; @@ -199,7 +199,7 @@ export abstract class CurvePoolGaugeContractPositionFetcher< const workingSupply = Number(workingSupplyRaw) / 10 ** 18; const relativeWeight = Number(relativeWeightRaw) / 10 ** 18; - const secondsPerYear = moment.duration(1, 'year').asSeconds(); + const secondsPerYear = duration(1, 'year').asSeconds(); const ratePerSecond = (inflationRate * relativeWeight * 0.4) / workingSupply; const apy = ((ratePerSecond * secondsPerYear) / stakedToken.price) * rewardTokens[0].price * 100; const isActive = Number(inflationRate) > 0; diff --git a/src/apps/hidden-hand/common/hidden-hand.rewards-resolver.ts b/src/apps/hidden-hand/common/hidden-hand.rewards-resolver.ts index b55bec69a..317df7d8f 100644 --- a/src/apps/hidden-hand/common/hidden-hand.rewards-resolver.ts +++ b/src/apps/hidden-hand/common/hidden-hand.rewards-resolver.ts @@ -195,7 +195,7 @@ export class HiddenHandRewardsResolver { constructor( @Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit, @Inject(HiddenHandViemContractFactory) protected readonly contractFactory: HiddenHandViemContractFactory, - ) { } + ) {} @Cache({ key: `studio:hidden-hand:claimable-raw-data`, diff --git a/src/apps/hidden-hand/common/hidden-hand.rewards.contract-position-fetcher.ts b/src/apps/hidden-hand/common/hidden-hand.rewards.contract-position-fetcher.ts index f8f279e2b..93d06aed7 100644 --- a/src/apps/hidden-hand/common/hidden-hand.rewards.contract-position-fetcher.ts +++ b/src/apps/hidden-hand/common/hidden-hand.rewards.contract-position-fetcher.ts @@ -75,7 +75,7 @@ export abstract class HiddenHandRewardsContractPositionFetcher extends CustomCon ); const market = marketEntry ? marketEntry[0] : ''; - if (!distribution?.hasOwnProperty(market)) return []; + if (!distribution[market]) return []; const claimableDistribution = distribution[market][neworkId] ?? {}; const claimableTokens = Object.keys(claimableDistribution); diff --git a/src/apps/inverse-firm/ethereum/inverse-firm.loan.contract-position-fetcher.ts b/src/apps/inverse-firm/ethereum/inverse-firm.loan.contract-position-fetcher.ts index 37347ee0d..f6cdb322f 100644 --- a/src/apps/inverse-firm/ethereum/inverse-firm.loan.contract-position-fetcher.ts +++ b/src/apps/inverse-firm/ethereum/inverse-firm.loan.contract-position-fetcher.ts @@ -161,14 +161,14 @@ export class EthereumInverseFirmLoanContractPositionFetcher extends ContractPosi if (isCvxFxsMarket) { const stakeContract = this.contractFactory.stCvxFxs({ address: this.stCvxFxsAddress, network: this.network }); const result = await multicall.wrap(stakeContract).read.claimableRewards([personalEscrow]); - claimablesAsTuple = result.map((v, i) => ({ token: v.token, amount: v.amount })); + claimablesAsTuple = result.map(v => ({ token: v.token, amount: v.amount })); } else { const stakeContract = this.contractFactory.stCvxCrv({ address: this.stCvxCrvAddress, network: this.network }); const result = await multicall .wrap(stakeContract) .simulate.earned([personalEscrow]) .then(v => v.result); - claimablesAsTuple = result.map((v, i) => ({ token: v.token, amount: v.amount })); + claimablesAsTuple = result.map(v => ({ token: v.token, amount: v.amount })); } } diff --git a/src/apps/mean-finance/common/mean-finance.dca-position.contract-position-fetcher.ts b/src/apps/mean-finance/common/mean-finance.dca-position.contract-position-fetcher.ts index 9677155bc..a3c954735 100644 --- a/src/apps/mean-finance/common/mean-finance.dca-position.contract-position-fetcher.ts +++ b/src/apps/mean-finance/common/mean-finance.dca-position.contract-position-fetcher.ts @@ -1,7 +1,7 @@ import { Inject } from '@nestjs/common'; import { BigNumber, BigNumberish } from 'ethers'; import { compact, merge, reduce, sumBy, uniqBy } from 'lodash'; -import moment from 'moment'; +import { duration } from 'moment'; import 'moment-duration-format'; import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; @@ -198,8 +198,8 @@ export abstract class MeanFinanceDcaPositionContractPositionFetcher extends Cust // Display Properties const formattedRate = rate < 0.001 ? '<0.001' : rate.toFixed(3); - const intervalMoment = moment.duration(swapInterval, 'seconds'); - const remainingMoment = moment.duration(remainingSwaps * swapInterval, 'seconds'); + const intervalMoment = duration(swapInterval, 'seconds'); + const remainingMoment = duration(remainingSwaps * swapInterval, 'seconds'); const intervalLabel = intervalMoment.format('w [weeks], d [days], h [hours], m [minutes]', { trim: 'all' }); const remainingLabel = remainingMoment.format('w [weeks], d [days], h [hours], m [minutes]', { trim: 'all', diff --git a/src/apps/pool-together-v4/common/pool-together-v4.api.prize-pool-registry.ts b/src/apps/pool-together-v4/common/pool-together-v4.api.prize-pool-registry.ts index 5d6333a44..208a2ec39 100644 --- a/src/apps/pool-together-v4/common/pool-together-v4.api.prize-pool-registry.ts +++ b/src/apps/pool-together-v4/common/pool-together-v4.api.prize-pool-registry.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import Axios from 'axios'; -import moment from 'moment'; +import { duration } from 'moment'; import { Cache } from '~cache/cache.decorator'; import { Network, NETWORK_IDS } from '~types/network.interface'; @@ -29,7 +29,7 @@ type V4ApiPrizePool = { export class PoolTogetherV4ApiPrizePoolRegistry { @Cache({ key: (network: Network) => `pool-together-v4:${network}:prize-pool-registry`, - ttl: moment.duration(30, 'minutes').asSeconds(), + ttl: duration(30, 'minutes').asSeconds(), }) async getV4PrizePools(network: Network): Promise { const prizePoolUrl = `https://pooltogether-api.com/v4/addresses/prize-pools/${NETWORK_IDS[network]}`; diff --git a/src/apps/spool/ethereum/spool.vault.contract-position-fetcher.ts b/src/apps/spool/ethereum/spool.vault.contract-position-fetcher.ts index acd51c075..1fafa53a0 100644 --- a/src/apps/spool/ethereum/spool.vault.contract-position-fetcher.ts +++ b/src/apps/spool/ethereum/spool.vault.contract-position-fetcher.ts @@ -232,7 +232,6 @@ export class EthereumSpoolVaultContractPositionFetcher extends ContractPositionT address, contractPosition, contract, - multicall, }: GetTokenBalancesParams): Promise { const strategies = contractPosition.dataProps.strategies; const { result } = await contract.simulate.getUpdatedUser([strategies], { account: address });