Skip to content

Commit

Permalink
import-order-prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
bergarces committed Sep 5, 2023
1 parent 4141b83 commit d997894
Show file tree
Hide file tree
Showing 21 changed files with 158 additions and 60 deletions.
5 changes: 4 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"trailingComma": "all",
"semi": false,
"singleQuote": true,
"printWidth": 80
"printWidth": 80,
"importOrder": ["<THIRD_PARTY_MODULES>", "^[./]"],
"importOrderSortSpecifiers": true
}
100 changes: 98 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"test:cov": "jest src --ci --coverage"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@typechain/ethers-v5": "^11.1.1",
"@types/eslint": "^8.44.1",
"@types/ethereum-block-by-date": "^1.4.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { ethers } from 'ethers'
import { Protocol } from '../../..'
import { Chain } from '../../../../core/constants/chains'
import { ERC20 } from '../../../../core/utils/getTokenMetadata'
import {
GetAprInput,
GetApyInput,
GetEventsInput,
GetPositionsInput,
GetPricesInput,
GetProfitsInput,
GetTotalValueLockedInput,
IProtocolAdapter,
ProtocolDetails,
MovementsByBlock,
PositionType,
TokenType,
ProfitsTokensWithRange,
ProtocolAprToken,
ProtocolApyToken,
ProtocolDetails,
ProtocolPricePerShareToken,
ProtocolToken,
ProtocolTotalValueLockedToken,
GetAprInput,
GetApyInput,
ProtocolAprToken,
ProtocolApyToken,
TokenType,
} from '../../../../types/adapter'
import { ethers } from 'ethers'
import { Json } from '../../../../types/json'
import { ERC20 } from '../../../../core/utils/getTokenMetadata'
import { Protocol } from '../../..'

export class ExampleProductAdapter implements IProtocolAdapter {
private metadata: Json
Expand Down
9 changes: 4 additions & 5 deletions src/adapters/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { ethers } from 'ethers'
import { Chain } from '../core/constants/chains'
import { IProtocolAdapter } from '../types/adapter'
import { ExampleProductAdapter } from './example/products/example-product/exampleProductAdapter'
import ARBITRUM_POOL_METADATA from './stargate/products/pool/arbitrum/metadata.json'
import ETHEREUM_POOL_METADATA from './stargate/products/pool/ethereum/metadata.json'
import { StargatePoolAdapter } from './stargate/products/pool/stargatePoolAdapter'
import { StargateVestingAdapter } from './stargate/products/vesting/stargateVestingAdapter'
import ETHEREUM_VESTING_METADATA from './stargate/products/vesting/ethereum/metadata.json'
import ETHEREUM_POOL_METADATA from './stargate/products/pool/ethereum/metadata.json'
import ARBITRUM_POOL_METADATA from './stargate/products/pool/arbitrum/metadata.json'

import { ExampleProductAdapter } from './example/products/example-product/exampleProductAdapter'
import { StargateVestingAdapter } from './stargate/products/vesting/stargateVestingAdapter'

// Add new protocols names below
export const Protocol = {
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/metadataBuilders.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Chain } from '../core/constants/chains'
import { Protocol } from '.'
import { Chain } from '../core/constants/chains'
import { buildMetadata } from './stargate/buildMetadata'

export type ProtocolMetadataBuilders = {
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/stargate/buildMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { ethers } from 'ethers'
import { promises as fs } from 'fs'
import path from 'path'
import { Protocol } from '..'
import {
StargateFactory__factory,
StargateToken__factory,
StargateVotingEscrow__factory,
} from '../../contracts'
import { Chain, ChainNames } from '../../core/constants/chains'
import { Protocol } from '..'
import { chainProviders } from '../../core/utils/chainProviders'
import { ERC20, getTokenMetadata } from '../../core/utils/getTokenMetadata'
import { Json } from '../../types/json'
import { logger } from '../../core/utils/logger'
import { Json } from '../../types/json'

export type StargatePoolMetadata = Record<
string,
Expand Down
26 changes: 13 additions & 13 deletions src/adapters/stargate/products/pool/stargatePoolAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import { ethers } from 'ethers'
import { formatUnits } from 'ethers/lib/utils'
import { Protocol } from '../../..'
import { StargateToken__factory } from '../../../../contracts'
import { TransferEvent } from '../../../../contracts/Erc20'
import { AVERAGE_BLOCKS_PER_DAY } from '../../../../core/constants/AVERAGE_BLOCKS_PER_DAY'
import { Chain } from '../../../../core/constants/chains'
import { Protocol } from '../../..'
import { ZERO_ADDRESS } from '../../../../core/constants/ZERO_ADDRESS'
import { getBalances } from '../../../../core/utils/getBalances'
import { calculateProfit } from '../../../../core/utils/calculateProfit'
import { Chain } from '../../../../core/constants/chains'
import { aggregateTrades } from '../../../../core/utils/aggregateTrades'
import { calculateProfit } from '../../../../core/utils/calculateProfit'
import { getBalances } from '../../../../core/utils/getBalances'
import { ERC20 } from '../../../../core/utils/getTokenMetadata'
import { logger } from '../../../../core/utils/logger'
import { formatProtocolTokenArrayToMap } from '../../../../core/utils/protocolTokenToMap'
import {
GetAprInput,
GetApyInput,
GetEventsInput,
GetPositionsInput,
GetPricesInput,
GetProfitsInput,
GetTotalValueLockedInput,
IProtocolAdapter,
ProtocolDetails,
MovementsByBlock,
PositionType,
TokenType,
ProfitsTokensWithRange,
ProtocolAprToken,
ProtocolApyToken,
ProtocolDetails,
ProtocolPricePerShareToken,
ProtocolToken,
ProtocolTotalValueLockedToken,
ProtocolAprToken,
GetAprInput,
GetApyInput,
ProtocolApyToken,
TokenType,
} from '../../../../types/adapter'
import { StargatePoolMetadata } from '../../buildMetadata'
import { formatProtocolTokenArrayToMap } from '../../../../core/utils/protocolTokenToMap'
import { ERC20 } from '../../../../core/utils/getTokenMetadata'
import { logger } from '../../../../core/utils/logger'

export class StargatePoolAdapter implements IProtocolAdapter {
private metadata: StargatePoolMetadata
Expand Down
20 changes: 10 additions & 10 deletions src/adapters/stargate/products/vesting/stargateVestingAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { ethers } from 'ethers'
import { formatUnits } from 'ethers/lib/utils'
import { Protocol } from '../../..'
import { StargateVotingEscrow__factory } from '../../../../contracts'
import { Chain } from '../../../../core/constants/chains'
import { Protocol } from '../../..'
import { ERC20 } from '../../../../core/utils/getTokenMetadata'
import {
IProtocolAdapter,
ProtocolDetails,
MovementsByBlock,
GetAprInput,
GetApyInput,
GetPositionsInput,
GetTotalValueLockedInput,
IProtocolAdapter,
MovementsByBlock,
PositionType,
TokenType,
ProfitsTokensWithRange,
ProtocolAprToken,
ProtocolApyToken,
ProtocolDetails,
ProtocolPricePerShareToken,
ProtocolToken,
ProtocolTotalValueLockedToken,
ProtocolAprToken,
GetAprInput,
ProtocolApyToken,
GetApyInput,
TokenType,
} from '../../../../types/adapter'
import { StargateVestingMetadata } from '../../buildMetadata'
import { ERC20 } from '../../../../core/utils/getTokenMetadata'

export class StargateVestingAdapter implements IProtocolAdapter {
private metadata: StargateVestingMetadata
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils/CustomMulticallJsonRpcProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { providers } from 'ethers'
import { MulticallQueue } from './multicall'
import { logger } from './logger'
import { MulticallQueue } from './multicall'

export class CustomMulticallJsonRpcProvider extends providers.StaticJsonRpcProvider {
private multicallQueue: MulticallQueue
Expand Down
1 change: 1 addition & 0 deletions src/core/utils/caseConversion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { camelCase, upperFirst } from 'lodash'

export { kebabCase, camelCase, lowerCase, upperCase } from 'lodash'

export function pascalCase(string?: string) {
Expand Down
11 changes: 5 additions & 6 deletions src/core/utils/chainProviders.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ethers, Contract } from 'ethers'
import { Contract, ethers } from 'ethers'
import { Multicall } from '../../contracts'
import multicallAbi from '../../contracts/abis/multicall.json'
import { MULTICALL_ADDRESS } from '../constants/MULTICALL_ADDRESS'
import { Chain } from '../constants/chains'
import { logger } from './logger'
import { CustomMulticallJsonRpcProvider } from './CustomMulticallJsonRpcProvider'

import { logger } from './logger'
import { MulticallQueue } from './multicall'
import multicallAbi from '../../contracts/abis/multicall.json'
import { Multicall } from '../../contracts'
import { MULTICALL_ADDRESS } from '../constants/MULTICALL_ADDRESS'

const provider = ({
url,
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils/getBalances.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BigNumber } from 'ethers'
import { formatUnits } from 'ethers/lib/utils'
import { GetBalancesInput, TokenBalance } from '../../types/adapter'
import { filterMap } from './filters'
import { getAddressesBalances } from './getAddressesBalances'
import { GetBalancesInput, TokenBalance } from '../../types/adapter'

export const getBalances = async ({
chainId,
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/blockAverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from 'commander'
import EthDater from 'ethereum-block-by-date'
import { promises as fs } from 'fs'
import * as path from 'path'
import { parse, visit, types, print } from 'recast'
import { parse, print, types, visit } from 'recast'
import { Chain } from '../core/constants/chains'
import { chainProviders } from '../core/utils/chainProviders'
import { writeCodeFile } from './writeCodeFile'
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/buildMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dotenv/config'
import { protocolMetadataBuilders } from '../adapters/metadataBuilders'
import { Protocol } from '../adapters'
import { protocolMetadataBuilders } from '../adapters/metadataBuilders'

const buildMetadata = async ({ protocolId }: { protocolId?: Protocol }) => {
const metadataBuilders = Object.entries(protocolMetadataBuilders)
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/buildTypes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path'
import { runTypeChain, glob } from 'typechain'
import { glob, runTypeChain } from 'typechain'
import { logger } from '../core/utils/logger'

export const main = async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/featureCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
getTotalValueLocked,
getWithdrawals,
} from '..'
import { Chain } from '../core/constants/chains'
import { Protocol } from '../adapters'
import { Chain } from '../core/constants/chains'

export function featureCommands(program: Command) {
addressCommand(
Expand Down
Loading

0 comments on commit d997894

Please sign in to comment.