Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
irubido committed Feb 1, 2024
2 parents 26da949 + 1060069 commit e931854
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
10 changes: 5 additions & 5 deletions packages/plugin/src/MultichainHardhatRuntimeEnvironmentField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import { vars } from "hardhat/config";
import {
getConfigEnvironmentVariable,
getNetworkChainId,
mapNetworkArgs,
sumedFees,
transferStatusInterval,
mapNetworkArgs,
} from "./utils";
import { AdapterABI } from "./adapterABI";
import { DeployOptions, DeploymentInfo, NetworkArguments } from "./types";

export class MultichainHardhatRuntimeEnvironmentField {
private isValidated: boolean = false;
private isInitiated: boolean = false;
private domains: Domain[] = [];
private readonly web3: Web3 | null;

Expand All @@ -35,7 +35,7 @@ export class MultichainHardhatRuntimeEnvironmentField {
//current Sygma hardcoded gasLimit
private gasLimit = 1000000;

private async validateConfig(): Promise<void> {
private async initConfig(): Promise<void> {
const originChainId = await getNetworkChainId(
this.hre.network.name,
this.hre
Expand All @@ -47,7 +47,7 @@ export class MultichainHardhatRuntimeEnvironmentField {

this.domains = config.getDomains();

this.isValidated;
this.isInitiated;
}

/**
Expand Down Expand Up @@ -86,7 +86,7 @@ export class MultichainHardhatRuntimeEnvironmentField {
deploymentInfo: DeploymentInfo[];
receipt: Transaction;
} | void> {
if (!this.isValidated) await this.validateConfig();
if (!this.isInitiated) await this.initConfig();
if (!this.web3) return;

//optional params
Expand Down
16 changes: 12 additions & 4 deletions packages/plugin/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@ import {
NonPayableCallOptions,
} from "web3";

export interface NetworkArguments<Abi extends ContractAbi = any> {
[network: string]: {
args?: ContractConstructorArgs<Abi>;
export type DeploymentNetwork =
| "ethereum"
| "sepolia"
| "mumbai"
| "goerli"
| "holesky"
| string;

export type NetworkArguments<Abi extends ContractAbi = any> = {
[network in DeploymentNetwork]: {
args: ContractConstructorArgs<Abi>;
initData?: {
initMethodName: keyof ContractMethods<Abi>;
//impossible to type unless we do something like this.getInitMethod(artifact, methodName).encode(args);
initMethodArgs: unknown[];
};
};
}
};

export interface DeployOptions {
salt?: MatchPrimitiveType<"bytes32", unknown>;
Expand Down
7 changes: 1 addition & 6 deletions packages/plugin/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@ export function mapNetworkArgs<Abi extends ContractAbi = any>(
else {
throw new HardhatPluginError(
"@chainsafe/hardhat-plugin-multichain-deploy",
`Unavailable Networks in networkArgs: The following network ${networkName} is not supported as destination network.
Available networks: ${domains
.map((domain): string => `${domain.name}`)
.join(", ")
.replace(/, ([^,]*)$/, "")}\n
`
`Unavailable Networks in networkArgs: The following network ${networkName} is not supported as destination network.`
);
}

Expand Down

0 comments on commit e931854

Please sign in to comment.