Skip to content

Commit de63f1d

Browse files
authored
Merge pull request #5535 from NomicFoundation/fix-number-list
Fix numbered list in docs
2 parents f944cd5 + f652fc1 commit de63f1d

File tree

1 file changed

+75
-72
lines changed

1 file changed

+75
-72
lines changed

docs/src/content/ignition/docs/advanced/migrating.md

+75-72
Original file line numberDiff line numberDiff line change
@@ -8,77 +8,77 @@ To get started, we’ll uninstall the `hardhat-deploy` plugin and install the Ha
88

99
1. Remove the `hardhat-deploy` packages from your project:
1010

11-
::::tabsgroup{options="npm,yarn"}
11+
::::tabsgroup{options="npm,yarn"}
1212

13-
:::tab{value="npm"}
13+
:::tab{value="npm"}
1414

15-
```sh
16-
npm uninstall hardhat-deploy hardhat-deploy-ethers
17-
```
15+
```sh
16+
npm uninstall hardhat-deploy hardhat-deploy-ethers
17+
```
1818

19-
:::
19+
:::
2020

21-
:::tab{value=yarn}
21+
:::tab{value=yarn}
2222

23-
```sh
24-
yarn remove hardhat-deploy hardhat-deploy-ethers
25-
```
23+
```sh
24+
yarn remove hardhat-deploy hardhat-deploy-ethers
25+
```
2626

27-
:::
27+
:::
2828

29-
::::
29+
::::
3030

3131
2. Install the Hardhat Ignition package and `hardhat-network-helpers` to provide additional testing support as a replacement for `hardhat-deploy` functionality like EVM snapshots:
3232

33-
::::tabsgroup{options="npm,yarn"}
33+
::::tabsgroup{options="npm,yarn"}
3434

35-
:::tab{value="npm"}
35+
:::tab{value="npm"}
3636

37-
```sh
38-
npm install --save-dev @nomicfoundation/hardhat-ignition-ethers @nomicfoundation/hardhat-network-helpers
39-
```
37+
```sh
38+
npm install --save-dev @nomicfoundation/hardhat-ignition-ethers @nomicfoundation/hardhat-network-helpers
39+
```
4040

41-
:::
41+
:::
4242

43-
:::tab{value=yarn}
43+
:::tab{value=yarn}
4444

45-
```sh
46-
yarn add --dev @nomicfoundation/hardhat-ignition-ethers @nomicfoundation/hardhat-network-helpers
47-
```
45+
```sh
46+
yarn add --dev @nomicfoundation/hardhat-ignition-ethers @nomicfoundation/hardhat-network-helpers
47+
```
4848

49-
:::
49+
:::
5050

51-
::::
51+
::::
5252

5353
3. Update the project’s `hardhat.config` file to remove `hardhat-deploy` and `hardhat-deploy-ethers` and instead import Hardhat Ignition:
5454

55-
::::tabsgroup{options="typescript,javascript"}
55+
::::tabsgroup{options="typescript,javascript"}
5656

57-
:::tab{value="typescript"}
57+
:::tab{value="typescript"}
5858

59-
```git
60-
- import "hardhat-deploy";
61-
- import "hardhat-deploy-ethers";
62-
+ import "@nomicfoundation/hardhat-ignition-ethers";
63-
```
59+
```git
60+
- import "hardhat-deploy";
61+
- import "hardhat-deploy-ethers";
62+
+ import "@nomicfoundation/hardhat-ignition-ethers";
63+
```
6464

65-
:::
65+
:::
6666

67-
:::tab{value=javascript}
67+
:::tab{value=javascript}
6868

69-
```git
70-
- require("hardhat-deploy");
71-
- require("hardhat-deploy-ethers");
72-
+ require("@nomicfoundation/hardhat-ignition-ethers");
73-
```
69+
```git
70+
- require("hardhat-deploy");
71+
- require("hardhat-deploy-ethers");
72+
+ require("@nomicfoundation/hardhat-ignition-ethers");
73+
```
7474

75-
:::
75+
:::
7676

77-
::::
77+
::::
7878

7979
## Convert deployment scripts to Ignition Modules
8080

81-
`hardhat-deploy` represents contract deployments as JavaScript or TypeScript files under the `./deploy/` folder. Hardhat Ignition follows a similar pattern with deployments encapsulated as modules; these are JS/TS files stored under the `./ignition/modules directory`. Each `hardhat-deploy` deploy file will be converted or merged into a Hardhat Ignition module.
81+
`hardhat-deploy` represents contract deployments as JavaScript or TypeScript files under the `./deploy/` folder. Hardhat Ignition follows a similar pattern with deployments encapsulated as modules; these are JS/TS files stored under the `./ignition/modules` directory. Each `hardhat-deploy` deploy file will be converted or merged into a Hardhat Ignition module.
8282

8383
Let’s first create the required folder structure under the root of your project:
8484

@@ -97,13 +97,16 @@ contract Token {
9797
uint256 public totalSupply = 1000000;
9898
address public owner;
9999
mapping(address => uint256) balances;
100+
100101
constructor(address _owner) {
101102
balances[_owner] = totalSupply;
102103
owner = _owner;
103104
}
105+
104106
function balanceOf(address account) external view returns (uint256) {
105107
return balances[account];
106108
}
109+
107110
function transfer(address to, uint256 amount) external {
108111
require(balances[msg.sender] >= amount, "Not enough tokens");
109112
balances[msg.sender] -= amount;
@@ -123,9 +126,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
123126
const { deployments, getNamedAccounts } = hre;
124127
const { deploy } = deployments;
125128
/*
126-
The deploy function uses the hardhat-deploy named accounts feature
127-
to set the deployment's `from` and `args` parameters.
128-
*/
129+
The deploy function uses the hardhat-deploy named accounts feature
130+
to set the deployment's `from` and `args` parameters.
131+
*/
129132
const { deployer, tokenOwner } = await getNamedAccounts();
130133
await deploy("Token", {
131134
from: deployer,
@@ -152,29 +155,29 @@ import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
152155
For instance, you can deploy contracts via `m.contract()`.
153156
*/
154157
export default buildModule("TokenModule", (m) => {
155-
/*
156-
Instead of named accounts, you get access to the configured accounts
157-
through the `getAccount()` method.
158-
*/
158+
/*
159+
Instead of named accounts, you get access to the configured accounts
160+
through the `getAccount()` method.
161+
*/
159162
const deployer = m.getAccount(0);
160163
const tokenOwner = m.getAccount(1);
161164

162165
/*
163-
Deploy `Token` by calling `contract()` with the constructor arguments
164-
as the second argument. The account to use for the deployment transaction
165-
is set through `from` in the third argument, which is an options object.
166-
*/
166+
Deploy `Token` by calling `contract()` with the constructor arguments
167+
as the second argument. The account to use for the deployment transaction
168+
is set through `from` in the third argument, which is an options object.
169+
*/
167170
const token = m.contract("Token", [tokenOwner], {
168171
from: deployer,
169172
});
170173

171174
/*
172-
The call to `m.contract()` returns a future that can be used in other `m.contract()`
173-
calls (e.g. as a constructor argument, where the future will resolve to the
174-
deployed address), but it can also be returned from the module. Contract
175-
futures that are returned from the module can be leveraged in Hardhat tests
176-
and scripts, as will be shown later.
177-
*/
175+
The call to `m.contract()` returns a future that can be used in other `m.contract()`
176+
calls (e.g. as a constructor argument, where the future will resolve to the
177+
deployed address), but it can also be returned from the module. Contract
178+
futures that are returned from the module can be leveraged in Hardhat tests
179+
and scripts, as will be shown later.
180+
*/
178181
return { token };
179182
});
180183
```
@@ -193,29 +196,29 @@ const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");
193196
For instance, you can deploy contracts via `m.contract()`.
194197
*/
195198
module.exports = buildModule("TokenModule", (m) => {
196-
/*
197-
Instead of named accounts, you get access to the configured accounts
198-
through the `getAccount()` method.
199-
*/
199+
/*
200+
Instead of named accounts, you get access to the configured accounts
201+
through the `getAccount()` method.
202+
*/
200203
const deployer = m.getAccount(0);
201204
const tokenOwner = m.getAccount(1);
202205

203206
/*
204-
Deploy `Token` by calling `contract()` with the constructor arguments
205-
as the second argument. The account to use for the deployment transaction
206-
is set through `from` in the third argument, which is an options object.
207-
*/
207+
Deploy `Token` by calling `contract()` with the constructor arguments
208+
as the second argument. The account to use for the deployment transaction
209+
is set through `from` in the third argument, which is an options object.
210+
*/
208211
const token = m.contract("Token", [tokenOwner], {
209212
from: deployer,
210213
});
211214

212215
/*
213-
The call to `m.contract()` returns a future that can be used in other `m.contract()`
214-
calls (e.g. as a constructor argument, where the future will resolve to the
215-
deployed address), but it can also be returned from the module. Contract
216-
futures that are returned from the module can be leveraged in Hardhat tests
217-
and scripts, as will be shown later.
218-
*/
216+
The call to `m.contract()` returns a future that can be used in other `m.contract()`
217+
calls (e.g. as a constructor argument, where the future will resolve to the
218+
deployed address), but it can also be returned from the module. Contract
219+
futures that are returned from the module can be leveraged in Hardhat tests
220+
and scripts, as will be shown later.
221+
*/
219222
return { token };
220223
});
221224
```

0 commit comments

Comments
 (0)