diff --git a/.eslint-tsconfig b/.eslint-tsconfig index ab94308c..a50a3038 100644 --- a/.eslint-tsconfig +++ b/.eslint-tsconfig @@ -1,8 +1,11 @@ { "extends": "./tsconfig.json", "include": [ - "tests", + "./src", + "./typechain", "docgen-templates", - "commitlint.config.js" + "commitlint.config.js", + "wagmi.config.ts", + "src/environment.d.ts" ] } diff --git a/.eslintignore b/.eslintignore index e843e6c4..02f86fb2 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,3 +4,5 @@ cache coverage dist typechain +src/config/abis/generated.ts +subgraph-client/.graphqlclient diff --git a/.eslintrc b/.eslintrc index 8c67a3d3..6f8b35e6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -34,6 +34,7 @@ "varsIgnorePattern": "_" } ], + "@typescript-eslint/ban-ts-comment": "warn", "spaced-comment": [ "error", "always", diff --git a/.prettierrc b/.prettierrc index 3aec6855..e794b58c 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,7 +3,7 @@ "bracketSpacing": true, "endOfLine": "auto", "importOrder": ["module-alias/register", "", "^[./]"], - "importOrderParserPlugins": ["typescript"], + "importOrderParserPlugins": ["typescript", "importAssertions"], "importOrderSeparation": true, "importOrderSortSpecifiers": true, "printWidth": 120, diff --git a/src/config/addresses.ts b/src/config/addresses.ts index 8b028077..6587bc8c 100644 --- a/src/config/addresses.ts +++ b/src/config/addresses.ts @@ -1,12 +1,13 @@ import bscmainnetGovernance from "@venusprotocol/governance-contracts/deployments/bscmainnet_addresses.json"; import bsctestnetGovernance from "@venusprotocol/governance-contracts/deployments/bsctestnet_addresses.json"; +import bscmainnetIsolated from "@venusprotocol/isolated-pools/deployments/bscmainnet_addresses.json"; +import bsctestnetIsolated from "@venusprotocol/isolated-pools/deployments/bsctestnet_addresses.json"; import bscmainnetProtocolReserve from "@venusprotocol/protocol-reserve/deployments/bscmainnet_addresses.json"; import bsctestnetProtocolReserve from "@venusprotocol/protocol-reserve/deployments/bsctestnet_addresses.json"; import bscmainnetCore from "@venusprotocol/venus-protocol/deployments/bscmainnet_addresses.json"; import bsctestnetCore from "@venusprotocol/venus-protocol/deployments/bsctestnet_addresses.json"; -import bscmainnetIsolated from "@venusprotocol/isolated-pools/deployments/bscmainnet_addresses.json"; -import bsctestnetIsolated from "@venusprotocol/isolated-pools/deployments/bsctestnet_addresses.json"; -import { SUPPORTED_CHAINS } from './chains'; + +import { SUPPORTED_CHAINS } from "./chains"; const addresses = { bscmainnet: { @@ -27,7 +28,7 @@ const addresses = { USDCPrimeConverter: bscmainnetProtocolReserve.addresses.USDCPrimeConverter, USDTPrimeConverter: bscmainnetProtocolReserve.addresses.USDTPrimeConverter, XVSVaultConverter: bscmainnetProtocolReserve.addresses.XVSVaultConverter, - TokenConverterOperator: '0x', + TokenConverterOperator: "0x", }, bsctestnet: { ...bsctestnetCore.addresses, @@ -53,7 +54,7 @@ const addresses = { type Addresses = typeof addresses; export type HasAddressFor = { - [ChainT in keyof Addresses]: Addresses[ChainT] extends Record ? ChainT : never; + [ChainT in keyof Addresses]: Addresses[ChainT] extends Record ? ChainT : never; }[keyof Addresses]; const network = process.env.FORKED_NETWORK as SUPPORTED_CHAINS; diff --git a/src/converter-bot/tokenConverterBot.ts b/src/converter-bot/tokenConverterBot.ts index 302ba182..49e4241f 100644 --- a/src/converter-bot/tokenConverterBot.ts +++ b/src/converter-bot/tokenConverterBot.ts @@ -14,7 +14,7 @@ type SupportedConverters = | "USDTPrimeConverter" | "XVSVaultConverter"; -const REVERT_IF_NOT_MINED_AFTER = 60n; //seconds +const REVERT_IF_NOT_MINED_AFTER = 60n; // seconds export type SUPPORTED_CHAINS = HasAddressFor<"TokenConverterOperator" | SupportedConverters>; diff --git a/src/environment.d.ts b/src/environment.d.ts index eb68a10a..182915ea 100644 --- a/src/environment.d.ts +++ b/src/environment.d.ts @@ -2,11 +2,11 @@ declare global { namespace NodeJS { interface ProcessEnv { - FORKED_NETWORK: 'bsctestnet' | 'bscmainnet' + FORKED_NETWORK: "bsctestnet" | "bscmainnet"; } } } // If this file has no import/export statements (i.e. is a script) // convert it into a module by adding an empty export statement. -export { }; +export {}; diff --git a/tsconfig.json b/tsconfig.json index 102c48f0..3624dc9c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,6 @@ "@nomiclabs/hardhat-ethers": ["./node_modules/hardhat-deploy-ethers"] } }, - "include": ["./typechain", "./tests"], + "include": ["./typechain"], "files": ["./hardhat.config.ts"] } diff --git a/wagmi.config.ts b/wagmi.config.ts index 80ead800..1a99b8c8 100644 --- a/wagmi.config.ts +++ b/wagmi.config.ts @@ -1,54 +1,54 @@ -import { defineConfig } from '@wagmi/cli' -import { hardhat } from '@wagmi/cli/plugins' -import poolLensArtifact from '@venusprotocol/isolated-pools/artifacts/contracts/Lens/PoolLens.sol/PoolLens.json' assert { type: "json"}; -import diamondComptrollerArtifact from '@venusprotocol/venus-protocol/artifacts/contracts/Comptroller/Diamond/DiamondConsolidated.sol/DiamondConsolidated.json' assert { type: "json"}; -import ilComptrollerArtifact from '@venusprotocol/isolated-pools/artifacts/contracts/Comptroller.sol/Comptroller.json' assert { type: "json"}; -import coreVTokenArtifact from '@venusprotocol/venus-protocol/artifacts/contracts/Tokens/VTokens/VBep20Delegate.sol/VBep20Delegate.json' assert { type: "json"}; -import protocolShareReserveArtifact from '@venusprotocol/protocol-reserve/artifacts/contracts/ProtocolReserve/ProtocolShareReserve.sol/ProtocolShareReserve.json' assert { type: "json"}; -import vBnbAdminArtifact from '@venusprotocol/venus-protocol/artifacts/contracts/Admin/VBNBAdmin.sol/VBNBAdmin.json' assert { type: "json"}; -import vBNB from '@venusprotocol/venus-protocol/artifacts/contracts/Admin/VBNBAdminStorage.sol/VTokenInterface.json' assert { type: "json"}; +import ilComptrollerArtifact from "@venusprotocol/isolated-pools/artifacts/contracts/Comptroller.sol/Comptroller.json" assert { type: "json" }; +import poolLensArtifact from "@venusprotocol/isolated-pools/artifacts/contracts/Lens/PoolLens.sol/PoolLens.json" assert { type: "json" }; +import protocolShareReserveArtifact from "@venusprotocol/protocol-reserve/artifacts/contracts/ProtocolReserve/ProtocolShareReserve.sol/ProtocolShareReserve.json" assert { type: "json" }; +import vBnbAdminArtifact from "@venusprotocol/venus-protocol/artifacts/contracts/Admin/VBNBAdmin.sol/VBNBAdmin.json" assert { type: "json" }; +import vBNB from "@venusprotocol/venus-protocol/artifacts/contracts/Admin/VBNBAdminStorage.sol/VTokenInterface.json" assert { type: "json" }; +import diamondComptrollerArtifact from "@venusprotocol/venus-protocol/artifacts/contracts/Comptroller/Diamond/DiamondConsolidated.sol/DiamondConsolidated.json" assert { type: "json" }; +import coreVTokenArtifact from "@venusprotocol/venus-protocol/artifacts/contracts/Tokens/VTokens/VBep20Delegate.sol/VBep20Delegate.json" assert { type: "json" }; +import { defineConfig } from "@wagmi/cli"; +import { hardhat } from "@wagmi/cli/plugins"; +import { Abi } from "abitype"; - -const getExternalContracts = async (): Promise => [ +const getExternalContracts = async (): Promise<{ name: string; abi: Abi }[]> => [ { - abi: poolLensArtifact.abi, - name: 'PoolLens' + abi: poolLensArtifact.abi as Abi, + name: "PoolLens", }, { - abi: diamondComptrollerArtifact.abi, - name: 'CoreComptroller' + abi: diamondComptrollerArtifact.abi as Abi, + name: "CoreComptroller", }, { - abi: ilComptrollerArtifact.abi, - name: 'IlComptroller' + abi: ilComptrollerArtifact.abi as Abi, + name: "IlComptroller", }, { - abi: coreVTokenArtifact.abi, - name: 'CoreVToken' + abi: coreVTokenArtifact.abi as Abi, + name: "CoreVToken", }, { - abi: protocolShareReserveArtifact.abi, - name: 'ProtocolShareReserve' + abi: protocolShareReserveArtifact.abi as Abi, + name: "ProtocolShareReserve", }, { - abi: vBnbAdminArtifact.abi, - name: 'VBnbAdmin' + abi: vBnbAdminArtifact.abi as Abi, + name: "VBnbAdmin", }, { - abi: vBNB.abi, - name: 'vBNB' - } -] + abi: vBNB.abi as Abi, + name: "vBNB", + }, +]; export default defineConfig(async () => { - const externalContracts = await getExternalContracts() + const externalContracts = await getExternalContracts(); return { - out: 'src/config/abis/generated.ts', + out: "src/config/abis/generated.ts", contracts: externalContracts, plugins: [ hardhat({ - project: '.', + project: ".", }), ], - } -}) + }; +});