Skip to content

Commit

Permalink
chore: touch up quickstart docs
Browse files Browse the repository at this point in the history
  • Loading branch information
itsacoyote committed Apr 15, 2024
1 parent cb38f41 commit dc4d1b0
Show file tree
Hide file tree
Showing 20 changed files with 217 additions and 171 deletions.
23 changes: 18 additions & 5 deletions content/10.quick-start/00.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In this guide, we'll walk you through the process of creating and deploying a si
By the end of the series, you will learn integral pieces that will
help you become a great developer on zkSync! You will learn how to:

:check-icon Initialize a new project with zksync-cli
:check-icon Initialize a new project with zksync-cli.

:check-icon Deploy contracts on zkSync Era using Hardhat or Foundry.

Expand All @@ -19,9 +19,11 @@ help you become a great developer on zkSync! You will learn how to:

:check-icon Implement a Paymaster to simplify transactions for your users.

---

## Install zksync-cli

Our Quickstart Guide series utilizes the `zksync-cli` to help you develop and interact with zkSync from your local machine.
Our Quickstart series utilizes the `zksync-cli` to help you develop and interact with zkSync from your local machine.
<!-- TODO: update link -->
<!-- Check out our [zksync-cli section](/content/tooling/zksync-cli) to learn more on how to use the CLI. -->

Expand All @@ -43,9 +45,9 @@ If you are unfamiliar with both, choose Node.js.

### Setup era local node (optional)

Our Quick Start series will have you compile and deploy contracts to
Our Quickstart series will have you compile and deploy contracts to
zkSync Sepolia testnet which requires you to have ETH in your wallet for funding transactions.
Our `zksync-cli` tool provides a way for you to setup a test node locally.
Alternatively, our `zksync-cli` tool provides a way for you to setup a test node locally.
This era local node allows for quicker testing and debugging processes without incurring testnet transaction costs.

#### Install Docker
Expand All @@ -68,6 +70,10 @@ The local era node will also include pre-configured rich wallets for use,
<!-- visit [era-test-node rich wallets](https://era.zksync.io/docs/tools/testing/era-test-node.html#use-pre-configured-rich-wallets) -->

Your local zkSync Era node is accessible at **[http://127.0.0.1:8011](http://127.0.0.1:8011/)**, ready for deployment or testing purposes.
Leave this terminal open and running as you build your projects.
When you are done running your local Era node, you can stop it with `Ctrl+C`.

---

## Choose Hardhat or Foundry

Expand Down Expand Up @@ -95,6 +101,8 @@ Install `foundry-zksync` with the following command:
curl -L https://foundry-zksync.zksync.io | bash
```

---

## Fund your wallet

If you did not set up a local era node for development and plan to use zkSync Sepolia testnet, you will need testnet ETH to fund transactions.
Expand All @@ -110,6 +118,8 @@ If you did not set up a local era node for development and plan to use zkSync Se

- Check your wallet's balance using the [zkSync Sepolia explorer](https://sepolia.explorer.zksync.io/).

---

## Configure your wallet in a project

To deploy contracts, you'll need to securely add your wallet's private key to the project environment. Follow these steps when you set up a new project:
Expand All @@ -131,10 +141,13 @@ To deploy contracts, you'll need to securely add your wallet's private key to th

- Replace **`your_private_key_here`** with your actual private key.

---

## Next Steps

You should now have a fully working local environment to build new projects on zkSync!

- Continue to [Hello zkSync!](/quick-start/hello-zksync) to begin the series on building a crowdfunding campaign for Zeek.
<!-- TODO: add a link to other guides -->
- You can skip on to creating your own projects using `zksync-cli` with your fully set up local dev environment.
- This setup provides you everything you need to build in zkSync.
You can skip on to creating your own projects using `zksync-cli` with your fully set up local dev environment.
12 changes: 10 additions & 2 deletions content/10.quick-start/10.hello-zksync.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Hello zkSync!
description: Learn to deploy smart contracts efficiently in the zkSync environment.
---

Welcome to the Quickstart Guide for deploying smart contracts on zkSync! In this series, we'll walk you through the process
Welcome to the Quickstart guide for deploying smart contracts on zkSync! In this series, we'll walk you through the process
of creating and deploying a simple smart contract that creates a crowdfunding campaign for Zeek. In this section you will learn the following:

:check-icon Initialize a new project with zkSync-cli.
Expand All @@ -14,6 +14,14 @@ of creating and deploying a simple smart contract that creates a crowdfunding ca

Let's dive in and start your developer journey on zkSync!

---

## Prerequisites

This Quickstart series requires some initial setup of tools to elevate your
development experience building for zkSync.
Make sure to go through the setup provided in the initial [Getting Started](/quick-start) section.

Select the framework you want to get started using zkSync Era with.

::content-switcher
Expand Down Expand Up @@ -41,7 +49,7 @@ Having successfully deployed your first contract on zkSync, you're well on your
a proficient zkSync developer. To expand your expertise:

- **Explore Contract Factories:** Enhance your project by building a contract factory
for the `CrowdfundingCampaign` contract in the [next guide](/quick-start/deploy-factory). This will allow you to efficiently
for the `CrowdfundingCampaign` contract in the [next guide](/quick-start/contract-factory). This will allow you to efficiently
manage multiple crowdfunding campaigns, each with its own unique parameters.
- **Dive Deeper into zkSync Features:** Investigate advanced zkSync features such as account abstraction,
and paymasters.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Contract Factories
description: Learn how to deploy and manage multiple smart contracts on zkSync using contract factories.
title: Contract Factory
description: Learn how to deploy and manage multiple smart contracts on zkSync using a contract factory.
---

This second quickstart installment advances from your introductory exploration of smart contract deployment to dive into the utility of contract factories.
This second Quickstart installment advances from your introductory exploration of smart contract deployment to dive into the utility of contract factories.
Through this guide, you'll learn how to streamline the deployment of multiple crowdfunding campaigns using a single contract factory, leveraging the
foundational `CrowdfundingCampaign` contract in the first guide.

Expand All @@ -22,7 +22,9 @@ contract instances from a single "factory" contract. It's essentially a contract
that creates other contracts, streamlining and organizing the deployment of
numerous similar contracts efficiently.

## Framework selection
---

## Setup the project

Select the framework you want to get started using zkSync Era with.

Expand Down
2 changes: 1 addition & 1 deletion content/10.quick-start/40.upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Learn to make smart contracts upgradeable within the zkSync ecosyst

In this fourth installment, we embark on a journey through contract upgradability,
an important aspect for maintaining and enhancing smart contracts over time. This guide will
lead you through the strategies and practices for making the `CrowdfundingCampaign` contract, **upgradeable**.
lead you through the strategies and practices for making the `CrowdfundingCampaign` contract **upgradeable**.

:check-icon Harness advanced techniques for contract upgradability in zkSync.

Expand Down
2 changes: 2 additions & 0 deletions content/10.quick-start/50.paymaster.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ As we explore paymasters, remember that while they offer enhanced flexibility fo
implementation should always prioritize security and user trust. This guide aims to equip you with the knowledge
to effectively incorporate paymasters into your zkSync projects, paving the way for more user-friendly and accessible dApps.

---

## Paymaster flow

Select the paymaster type you want to get started using zkSync Era with.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ title: Foundry | Deploy Contract Factory

:display-partial{path="quick-start/_partials/_setup-wallet"}

---

## Review the CrowdfundingFactory contract

With our environment and wallet configured, we're set to review the `CrowdfundingFactory.sol`
contract that is provided under the [`/src` directory](https://github.com/dutterbutter/zksync-foundry-quickstart-guide/blob/db/deploy-contract-factory/src/CrowdfundFactory.sol).
The `CrowdfundingFactory.sol` we will compile and deploy is provided under the [`/src` directory](https://github.com/dutterbutter/zksync-foundry-quickstart-guide/blob/db/deploy-contract-factory/src/CrowdfundFactory.sol).

The `CrowdfundingFactory.sol`contract will be used to deploy multiple instances of
the `CrowdfundingCampaign.sol` contract from the previous guide.
Expand Down Expand Up @@ -62,7 +63,6 @@ making it efficient to launch and manage multiple campaigns.

### Compile contract

<!-- :display-partial{path = "/_partials/_compile-solidity-contracts-foundry"} -->
Smart contracts deployed to zkSync must be compiled using our custom compiler.
For this particular guide we are making use of `zksolc`.

Expand All @@ -72,8 +72,6 @@ To compile the contracts in the project, run the following command:
forge build --zksync
```

#### Expected Output

Upon successful compilation, you'll receive output detailing the
`zksolc` and `solc` versions used during compiling and the number
of Solidity files compiled.
Expand All @@ -89,6 +87,8 @@ Compiling contracts for zkSync Era with zksolc v1.4.0
The compiled zkEVM artifacts will be located in the `/zkout` folder, and the solc
artifacts will be located in the `/out` folder.

---

## Deploy a CrowdfundingCampaign with CrowdfundingFactory

This section outlines the steps to deploy the `CrowdfundingCampaign` contract using
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ bun install

::

## Deploy contract with factory
## Set up your wallet

With our environment and wallet configured, we're set to review the `CrowdfundingFactory.sol`
:display-partial{path="quick-start/_partials/_setup-wallet"}

---

## Compile the contracts

This section will focus on compiling and deploying the `CrowdfundingFactory.sol`
contract that is provided under the [`/contracts` directory](https://github.com/dutterbutter/zksync-quickstart-guide/blob/db/contract-factories/contracts/CrowdfundFactory.sol).

The `CrowdfundingFactory.sol`contract will be used to deploy multiple instances of
the `CrowdfundingCampaign.sol` contract from the previous guide.
This contract factory approach streamlines the deployment of crowdfunding campaigns,
making it efficient to launch and manage multiple campaigns.

::drop-panel
::panel{label="CrowdfundingFactory.sol"}
Expand Down Expand Up @@ -83,11 +91,6 @@ deploys a new campaign contract with this goal, and tracks the created campaign
created by the factory, allowing for easy access and management of multiple crowdfunding
initiatives.

This contract factory approach streamlines the deployment of crowdfunding campaigns,
making it efficient to launch and manage multiple campaigns.

### Compile contract

:display-partial{path = "/_partials/_compile-solidity-contracts"}

Upon successful compilation, you'll receive output detailing the
Expand All @@ -102,7 +105,7 @@ Successfully compiled 2 Solidity file

The compiled artifacts will be located in the `/artifacts-zk` folder.

### Deploy via the CrowdfundingFactory
### Deploy CrowdfundingCampaigns via the CrowdfundingFactory

This section outlines the steps to deploy the `CrowdfundingCampaign` contract
using our new `CrowdfundingFactory`.
Expand Down Expand Up @@ -156,7 +159,7 @@ The deployment script is located at `/deploy/deployUsingFactory.ts`.
- The `createCampaign` method is called on this instance to create
and deploy a new crowdfunding campaign contract.

Execute the deployment command corresponding to your package manager. The default command
Run the deployment command. The default command
deploys to the configured network in your Hardhat setup. For local deployment, append
`--network inMemoryNode` to deploy to the local in-memory node running.

Expand Down
11 changes: 3 additions & 8 deletions content/10.quick-start/_hello-zksync/_foundry_deploy_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ title: Foundry | Deploy Contract

:display-partial{path = "/quick-start/_partials/_setup-wallet"}

## Deploy your first contract
## Compile your first contract

With our environment and wallet configured, we're set to deploy our first contract. This guide
This guide
introduces a crowdfunding campaign contract aimed at supporting Zeek's inventive ventures.

Let's start by reviewing the starter contract in the [`src/` directory](https://github.com/dutterbutter/zksync-foundry-quickstart-guide/blob/main/src/Crowdfund.sol).
Expand Down Expand Up @@ -77,8 +77,6 @@ Owned and deployed with a set funding goal, it features:
- The `contribute` method to log funds, triggering `ContributionReceived` and `GoalReached` events.
- The `withdrawFunds` method, allowing the owner to collect accumulated funds post-goal achievement.

### Compile contract

Smart contracts deployed to zkSync must be compiled using our custom compiler.
For this particular guide we are making use of `zksolc`.

Expand All @@ -103,9 +101,8 @@ Compiling contracts for zkSync Era with zksolc v1.4.0
The compiled zkEVM artifacts will be located in the `/zkout` folder, and the solc artifacts will be
located in the `/out` folder.

### Deploy
### Deploy the CrowdfundingCampaign contract

This section outlines the steps to deploy the `CrowdfundingCampaign` contract.
The deployment script is located at [`/script/Deploy.s.sol`](https://github.com/dutterbutter/zksync-foundry-quickstart-guide/blob/main/script/Deploy.s.sol).

```solidity
Expand Down Expand Up @@ -135,8 +132,6 @@ a single constructor argument, `fundingGoalInWei`.
- **Broadcast Method:** The deployment uses `vm.startBroadcast(deployerPrivateKey)` to begin
the transaction broadcast and `vm.stopBroadcast()` to end it, facilitating the actual deployment of the contract on the blockchain.

#### Deploy contract

Execute the deployment command.

```bash
Expand Down
15 changes: 3 additions & 12 deletions content/10.quick-start/_hello-zksync/_hardhat_deploy_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ bun install

:display-partial{path="quick-start/_partials/_setup-wallet"}

## Deploy the CrowdfundingCampaign.sol contract
## Compile the CrowdfundingCampaign.sol contract

With our environment and wallet configured, we're set to deploy our first contract.
This guide introduces a crowdfunding campaign contract aimed at supporting Zeek's inventive ventures.
Let's start by reviewing the starter contract in the [`contracts/` directory](https://github.com/dutterbutter/zksync-quickstart-guide/blob/main/contracts/Crowdfund.sol).

Expand Down Expand Up @@ -106,12 +105,8 @@ This contract features:
- The `contribute` method to log funds, triggering `ContributionReceived` and `GoalReached` events.
- The `withdrawFunds` method, allowing the owner to collect accumulated funds post-goal achievement.

### Compile contract

:display-partial{path = "/_partials/_compile-solidity-contracts"}

#### Expected Output

Upon successful compilation, you'll receive output detailing the
`zksolc` and `solc` versions used during compiling and the number
of Solidity files compiled.
Expand All @@ -124,9 +119,8 @@ Successfully compiled 1 Solidity file

The compiled artifacts will be located in the `/artifacts-zk` folder.

### Deploy
## Deploy the contract

This section outlines the steps to deploy the `CrowdfundingCampaign` contract.
The deployment script is located at [`/deploy/deploy.ts`](https://github.com/dutterbutter/zksync-quickstart-guide/blob/main/deploy/deploy.ts).

```typescript
Expand All @@ -148,8 +142,7 @@ export default async function () {
- **constructorArguments:** Sets initialization parameters for the contract. In this case,
the fundraising goal, converted from ether to `wei` to match Solidity's `uint256` type.

#### Deploy contract
Execute the deployment command corresponding to your package manager. The default command
1. Execute the deployment command corresponding to your package manager. The default command
deploys to the configured network in your Hardhat setup. For local deployment, append
`--network inMemoryNode` to deploy to the local in-memory node running.

Expand Down Expand Up @@ -181,8 +174,6 @@ bun run hardhat deploy-zksync --script deploy.ts

::

#### Expected Output

Upon successful deployment, you'll receive output detailing the deployment process,
including the contract address, source, and encoded constructor arguments:

Expand Down
Loading

0 comments on commit dc4d1b0

Please sign in to comment.