Skip to content

Commit

Permalink
fix: add importAssertion prettier plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Jan 29, 2024
1 parent b5b4630 commit b9af021
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 44 deletions.
7 changes: 5 additions & 2 deletions .eslint-tsconfig
Original file line number Diff line number Diff line change
@@ -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"
]
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ cache
coverage
dist
typechain
src/config/abis/generated.ts
subgraph-client/.graphqlclient
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"varsIgnorePattern": "_"
}
],
"@typescript-eslint/ban-ts-comment": "warn",
"spaced-comment": [
"error",
"always",
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"bracketSpacing": true,
"endOfLine": "auto",
"importOrder": ["module-alias/register", "<THIRD_PARTY_MODULES>", "^[./]"],
"importOrderParserPlugins": ["typescript"],
"importOrderParserPlugins": ["typescript", "importAssertions"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"printWidth": 120,
Expand Down
11 changes: 6 additions & 5 deletions src/config/addresses.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand All @@ -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,
Expand All @@ -53,7 +54,7 @@ const addresses = {
type Addresses = typeof addresses;

export type HasAddressFor<ContractName extends string> = {
[ChainT in keyof Addresses]: Addresses[ChainT] extends Record<ContractName, any> ? ChainT : never;
[ChainT in keyof Addresses]: Addresses[ChainT] extends Record<ContractName, string> ? ChainT : never;
}[keyof Addresses];

const network = process.env.FORKED_NETWORK as SUPPORTED_CHAINS;
Expand Down
2 changes: 1 addition & 1 deletion src/converter-bot/tokenConverterBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;

Expand Down
4 changes: 2 additions & 2 deletions src/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"@nomiclabs/hardhat-ethers": ["./node_modules/hardhat-deploy-ethers"]
}
},
"include": ["./typechain", "./tests"],
"include": ["./typechain"],
"files": ["./hardhat.config.ts"]
}
64 changes: 32 additions & 32 deletions wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -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<any> => [
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: ".",
}),
],
}
})
};
});

0 comments on commit b9af021

Please sign in to comment.