Skip to content

Commit

Permalink
Merge branch 'development' into multiple-validation-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeyTM committed Sep 29, 2023
2 parents 3a5ce6b + 0256ef6 commit ea3e1cd
Show file tree
Hide file tree
Showing 80 changed files with 2,055 additions and 955 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[![npm](https://img.shields.io/npm/v/@nomicfoundation/hardhat-ignition.svg)](https://www.npmjs.com/package/@nomicfoundation/hardhat-ignition) [![hardhat](https://hardhat.org/buidler-plugin-badge.svg?1)](https://hardhat.org)

# Ignition
# Hardhat Ignition

> **WARNING**: This repository is **highly experimental**, and is under **active development**. Any code or binaries produced from this project **should not be used in any production or critical workloads**. The API is preliminary, **the API will change**.
Ignition is **Hardhat**'s deployment solution. It is a **Hardhat** plugin that allows you to create declarative deployments that can be reproduced across different networks.
Hardhat Ignition is **Hardhat**'s deployment solution. It is a **Hardhat** plugin that allows you to create declarative deployments that can be reproduced across different networks.

Built by the [Nomic Foundation](https://nomic.foundation/) for the Ethereum community.

Expand All @@ -30,7 +30,7 @@ import "@nomicfoundation/hardhat-ignition";

## Getting Started

See our [Getting started guide](./docs/getting-started-guide.md) for a worked example of **Ignition usage**.
See our [Getting started guide](./docs/getting-started-guide.md) for a worked example of **Hardhat Ignition usage**.

## Documentation

Expand All @@ -39,28 +39,28 @@ See our [Getting started guide](./docs/getting-started-guide.md) for a worked ex
- [Creating Modules for Deployments](./docs/creating-modules-for-deployment.md)
- [Deploying a Contract](./docs/creating-modules-for-deployment.md#deploying-a-contract)
- [Calling contract methods](./docs/creating-modules-for-deployment.md#calling-contract-methods)
- [Network Accounts Management](./docs/creating-modules-for-deployment.md#network-accounts-management)
- [Including modules within modules](./docs/creating-modules-for-deployment.md#including-modules-within-modules)
- [Module Parameters](./docs/creating-modules-for-deployment.md#module-parameters)
- [Switching based on the _Network Chain ID_](./docs/creating-modules-for-deployment.md#switching-based-on-the-network-chain-id)
- [Using Ignition in _Hardhat_ tests](./docs/using-ignition-in-hardhat-tests.md)
- [Using Hardhat Ignition in _Hardhat_ tests](./docs/using-ignition-in-hardhat-tests.md)
- [Running a deployment](./docs/running-a-deployment.md)
- [Visualizing your deployment with the `visualize` task](./docs/running-a-deployment.md#visualizing-your-deployment-with-the-visualize-task)
- [Executing the deployment](./docs/running-a-deployment.md#executing-the-deployment)

### Examples

This repo contains example projects that show **Ignition** features in context (under `./examples`):
This repo contains example projects that show **Hardhat Ignition** features in context (under `./examples`):

- [Sample](./examples/sample) - the **Hardhat** starter project enhanced with Ignition
- [Typescript Sample](./examples/ts-sample) - the **Hardhat** typescript starter project enhanced with Ignition
- [Sample](./examples/sample) - the **Hardhat** starter project enhanced with Hardhat Ignition
- [Typescript Sample](./examples/ts-sample) - the **Hardhat** typescript starter project enhanced with Hardhat Ignition
- [ENS](./examples/ens) - deploy ENS and its registry for local testing
- [Uniswap](./examples/uniswap) - deploy Uniswap and test swaps

## Contributing

Contributions are always welcome! Feel free to open any issue or send a pull request.

Go to [CONTRIBUTING.md](./CONTRIBUTING.md) to learn about how to set up Ignition's development environment.
Go to [CONTRIBUTING.md](./CONTRIBUTING.md) to learn about how to set up Hardhat Ignition's development environment.

## Feedback, help and news

Expand Down
48 changes: 46 additions & 2 deletions package-lock.json

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

11 changes: 6 additions & 5 deletions packages/core/src/build-module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IgnitionError } from "./errors";
import { ERRORS } from "./errors-list";
import { ModuleConstructor } from "./internal/module-builder";
import { isValidIgnitionIdentifier } from "./internal/utils/identifier-validators";
import { IgnitionModule, IgnitionModuleResult } from "./types/module";
Expand All @@ -23,17 +24,17 @@ export function buildModule<
moduleDefintionFunction: (m: IgnitionModuleBuilder) => IgnitionModuleResultsT
): IgnitionModule<ModuleIdT, ContractNameT, IgnitionModuleResultsT> {
if (typeof moduleId !== "string") {
throw new IgnitionError(`\`moduleId\` must be a string`);
throw new IgnitionError(ERRORS.MODULE.INVALID_MODULE_ID);
}

if (!isValidIgnitionIdentifier(moduleId)) {
throw new IgnitionError(
`The moduleId "${moduleId}" contains banned characters, ids can only contain alphanumerics or underscores`
);
throw new IgnitionError(ERRORS.MODULE.INVALID_MODULE_ID_CHARACTERS, {
moduleId,
});
}

if (typeof moduleDefintionFunction !== "function") {
throw new IgnitionError(`\`moduleDefintionFunction\` must be a function`);
throw new IgnitionError(ERRORS.MODULE.INVALID_MODULE_DEFINITION_FUNCTION);
}

const constructor = new ModuleConstructor();
Expand Down
9 changes: 5 additions & 4 deletions packages/core/src/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IgnitionValidationError } from "./errors";
import { IgnitionError } from "./errors";
import { ERRORS } from "./errors-list";
import {
DEFAULT_AUTOMINE_REQUIRED_CONFIRMATIONS,
defaultConfig,
Expand Down Expand Up @@ -85,9 +86,9 @@ export async function deploy<

if (defaultSender !== undefined) {
if (!accounts.includes(defaultSender)) {
throw new IgnitionValidationError(
`Default sender ${defaultSender} is not part of the provided accounts`
);
throw new IgnitionError(ERRORS.VALIDATION.INVALID_DEFAULT_SENDER, {
defaultSender,
});
}
} else {
defaultSender = getDefaultSender(accounts);
Expand Down
Loading

0 comments on commit ea3e1cd

Please sign in to comment.