Skip to content
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/modules/ROOT/pages/module/deploy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ After an environment is configured, you can use it for deployments and upgrades.

Defender will use the default approve process for deployments and upgrades. However, the Hardhat and Foundry plugins allow you to specify a different approval process for upgrades. If a block explorer API key is not provided, Defender will try to verify the contracts with the default key. Otherwise, it will use the one provided.

Please note that upgrades count towards your Defender account's transaction proposal usage.

NOTE: We provide a quickstart tutorial to deploy and upgrade a smart contract using Defender with Hardhat and Foundry. Check it out xref:tutorial/deploy.adoc[here]!

WARNING: Using `CREATE2` may affect `msg.sender` behavior; see documentation for details xref:tutorial/deploy.adoc#deploy-caveat[here]!
Expand Down Expand Up @@ -95,4 +97,4 @@ To identify, tag, or classify deployments, you can use the `metadata` field, whi

Once the deployment is submitted, these metadata fields will be displayed in the Defender UI under _Metadata_, formatted in JSON.

image::deploy-metadata-1.0.png[Deploy Metadata]
image::deploy-metadata-1.0.png[Deploy Metadata]
17 changes: 12 additions & 5 deletions docs/modules/ROOT/pages/tutorial/deploy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ npm i @openzeppelin/hardhat-upgrades @openzeppelin/contracts-upgradeable dotenv
Once everything has been installed, your initial directory structure should look something like this:

+
image::tutorial-deploy-directory.png[Deploy directory structure,185,300]
image::tutorial-deploy-directory.png[Deploy directory structure,351,300]

. You now need to edit your Hardhat configuration to add the Defender keys and Sepolia network. Open the `hardhat.config.ts` file, and replace its content with the following code:
+
Expand All @@ -127,7 +127,7 @@ import "@openzeppelin/hardhat-upgrades";
require("dotenv").config();

const config: HardhatUserConfig = {
solidity: "0.8.20",
solidity: "0.8.28",
defender: {
apiKey: process.env.DEFENDER_KEY as string,
apiSecret: process.env.DEFENDER_SECRET as string,
Expand Down Expand Up @@ -159,7 +159,7 @@ DEFENDER_SECRET = "<<YOUR_SECRET>>"
[source,jsx]
----
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.20;
pragma solidity ^0.8.28;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
Expand Down Expand Up @@ -212,7 +212,7 @@ This is a contract that replicates a box, with three functions:
[source,jsx]
----
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.20;
pragma solidity ^0.8.28;

import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";
Expand Down Expand Up @@ -257,6 +257,13 @@ forge script script/Deploy.s.sol --force --rpc-url https://ethereum-sepolia.publ
[[hardhat-deploy]]
=== Hardhat

. Create a new directory called `scripts` and create a new file called `deploy.ts` in the new directory:
+
```
mkdir scripts && touch scripts/deploy.ts
```


. Open the file `deploy.ts` inside the `scripts` directory. This script will deploy the upgradeable Box contract through Defender with an initial amount of 5 objects inside and the owner as the multisig address configured in the environment setup. The `initializer` option is used to call the `initialize()` function after the contract is deployed. Copy and paste the code below into `deploy.ts`:
+
[source,jsx]
Expand Down Expand Up @@ -318,7 +325,7 @@ Upgrading a smart contract allows changing its logic while maintaining the same
[source,jsx]
----
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.20;
pragma solidity ^0.8.28;

import {Box} from "./Box.sol";

Expand Down