diff --git a/docs/modules/ROOT/assets/images/tutorial-deploy-directory.png b/docs/modules/ROOT/assets/images/tutorial-deploy-directory.png index 9033fa6d..4587bcec 100644 Binary files a/docs/modules/ROOT/assets/images/tutorial-deploy-directory.png and b/docs/modules/ROOT/assets/images/tutorial-deploy-directory.png differ diff --git a/docs/modules/ROOT/pages/module/deploy.adoc b/docs/modules/ROOT/pages/module/deploy.adoc index 61ad2358..19fbda64 100755 --- a/docs/modules/ROOT/pages/module/deploy.adoc +++ b/docs/modules/ROOT/pages/module/deploy.adoc @@ -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]! @@ -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] \ No newline at end of file +image::deploy-metadata-1.0.png[Deploy Metadata] diff --git a/docs/modules/ROOT/pages/tutorial/deploy.adoc b/docs/modules/ROOT/pages/tutorial/deploy.adoc index 7ea2c8e6..01da065b 100644 --- a/docs/modules/ROOT/pages/tutorial/deploy.adoc +++ b/docs/modules/ROOT/pages/tutorial/deploy.adoc @@ -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: + @@ -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, @@ -159,7 +159,7 @@ DEFENDER_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"; @@ -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"; @@ -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] @@ -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";