Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updated typings in HRE declaration and type errors in helpers #536

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/contracts/deploy/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export function getLatestContractAddress(

const latestNetworkDeployment = getLatestNetworkDeployment(osxNetworkName);
if (latestNetworkDeployment && contractName in latestNetworkDeployment) {
return latestNetworkDeployment[contractName].address;
// safe cast due to conditional above, but we return the fallback string anyhow
const key = contractName as keyof typeof latestNetworkDeployment;
return latestNetworkDeployment[key]?.address ?? '';
}
return '';
}
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import networks, {ContractsNetworkConfig} from './networks';
import {AragonPluginRepos, TestingFork} from './types/hardhat';
import {NetworkConfigs} from '@aragon/osx-commons-configs';
import {SupportedNetworks} from '@aragon/osx-commons-configs';
import '@nomicfoundation/hardhat-chai-matchers';
import '@nomicfoundation/hardhat-network-helpers';
import '@nomicfoundation/hardhat-verify';
Expand All @@ -9,7 +10,6 @@ import * as dotenv from 'dotenv';
import 'hardhat-deploy';
import 'hardhat-gas-reporter';
import {extendEnvironment, HardhatUserConfig} from 'hardhat/config';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import 'solidity-coverage';
import 'solidity-docgen';

Expand All @@ -25,11 +25,11 @@ const accounts = ETH_KEY ? ETH_KEY.split(',') : [];
// add accounts to network configs
const hardhatNetworks: NetworkConfigs<HardhatNetworksExtension> = networks;
for (const network of Object.keys(networks)) {
hardhatNetworks[network].accounts = accounts;
hardhatNetworks[network as SupportedNetworks].accounts = accounts;
}

// Extend HardhatRuntimeEnvironment
extendEnvironment((hre: HardhatRuntimeEnvironment) => {
extendEnvironment(hre => {
const aragonPluginRepos: AragonPluginRepos = {
AddresslistVotingRepoProxy: '',
TokenVotingRepoProxy: '',
Expand Down
8 changes: 6 additions & 2 deletions packages/contracts/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ const networkExtensions: NetworkConfigs<ContractsNetworkConfig> = {
...networks.arbitrum,
deploy: ['./deploy/new', './deploy/verification'],
},
arbitrumGoerli: {
...networks.arbitrumGoerli,
baseSepolia: {
...networks.baseSepolia,
deploy: ['./deploy/new', './deploy/verification'],
},
arbitrumSepolia: {
...networks.arbitrumSepolia,
deploy: ['./deploy/new', './deploy/verification'],
},
};
Expand Down
13 changes: 5 additions & 8 deletions packages/contracts/types/hardhat.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import {BigNumberish, BytesLike} from 'ethers';

export type AragonPluginRepos = {
'address-list-voting': string;
'token-voting': string;
// prettier-ignore
'admin': string;
// prettier-ignore
'multisig': string;
AddresslistVotingRepoProxy: string;
TokenVotingRepoProxy: string;
AdminRepoProxy: string;
MultisigRepoProxy: string;
[index: string]: string;
};

Expand All @@ -28,8 +26,7 @@ export type TestingFork = {
activeContracts: any;
};


declare module 'hardhat/types' {
declare module 'hardhat/types/runtime' {
interface HardhatRuntimeEnvironment {
aragonPluginRepos: AragonPluginRepos;
aragonToVerifyContracts: AragonVerifyEntry[];
Expand Down
Loading