Skip to content

Unify tutorials project initialization #753

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ npm init -y

### Configure Dependencies

Add the following to your `package.json`:
Add overrides in `package.json` so that there are no peer dependency related issues.

```json
{
Expand All @@ -52,22 +52,20 @@ Install the required dependencies:
npm add -D hardhat @safe-global/safe-contracts hardhat-dependency-compiler
```

### Setup Hardhat project

Initialize a TypeScript Hardhat project:
### Initialize hardhat project

```bash
npx hardhat init
```

Select `Create a TypeScript project` and leave the default values for the rest of the prompts.

Now, try compiling the contracts to ensure everything is set up correctly.

```bash
npx hardhat compile
```

Select `Create a TypeScript project` when prompted.

When compiling Safe contracts with solidity 0.8.x the bytecode size exceeds the limit of 24KB. To overcome this, set `allowUnlimitedContractSize` to `true` in the hardhat config.
In practise with production networks, use the officially deployed Safe contracts. Also, add `dependencyCompiler` to import `SafeProxyFactory` and `Safe` contracts.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ npm init -y

### Configure Dependencies

Add the following to your `package.json`:
Add overrides in `package.json` so that there are no peer dependency related issues.

```json
{
Expand All @@ -74,22 +74,20 @@ Install the required dependencies:
npm add -D hardhat @safe-global/safe-contracts hardhat-dependency-compiler
```

### Setup Hardhat project

Initialize a TypeScript Hardhat project:
### Initialize hardhat project

```bash
npx hardhat init
```

Select `Create a TypeScript project` and leave the default values for the rest of the prompts.

Now, try compiling the contracts to ensure everything is set up correctly.

```bash
npx hardhat compile
```

Select `Create a TypeScript project` when prompted.

When compiling Safe contracts with solidity 0.8.x the bytecode size exceeds the limit of 24KB. To overcome this, set `allowUnlimitedContractSize` to `true` in the hardhat config.
In practise with production networks, use the officially deployed Safe contracts. Also, add `dependencyCompiler` to import `SafeProxyFactory` and `Safe` contracts.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,22 @@ Important Notice: The smart contract code provided in this tutorial is intended

## Project Setup

Start a new project directory and initialize npm.
Create a new project directory and initialize npm:

```bash
mkdir safe-module-tutorial && cd safe-module-tutorial
mkdir safe-module-tutorial && cd safe-module-tutorial
npm init -y
```

```bash
npm init
```
You can choose all default values.

### Install dependencies
### Configure Dependencies

Add overrides in `package.json` so that there are no peer dependency related issues.

```json
{
// ...
// ... existing content ...
"overrides": {
"@safe-global/safe-contracts": {
"ethers": "^6.13.5"
Expand All @@ -55,6 +53,8 @@ Add overrides in `package.json` so that there are no peer dependency related iss
}
```

Install the required dependencies:

```bash
npm add -D hardhat @safe-global/safe-contracts @openzeppelin/contracts hardhat-dependency-compiler
```
Expand Down Expand Up @@ -88,7 +88,7 @@ const config: HardhatUserConfig = {
solidity: "0.8.28",
networks: {
hardhat: {
allowUnlimitedContractSize: true,
allowUnlimitedContractSize: true, // Required for Safe contracts
},
},
dependencyCompiler: {
Expand Down
Loading