-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat(cli/docs): introduce devnet quickstart guide #1080
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1297104
feat(cli): add hello world template
idea404 3ea110d
docs(quickstart): introduce quickstart section
idea404 eb70642
docs(quickstart): use .env file naming
idea404 ca30731
feat(cli): use url for templating
idea404 c38fede
fix: description in cli developer new cmd
idea404 829c95f
fix(docs): use anvil pkey 2
idea404 05db2c1
fix: address fix
idea404 8ebac07
fix: passing template name
idea404 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,10 @@ func bindAVSAddress(cmd *cobra.Command, addr *string) { | |
cmd.Flags().StringVar(addr, "avs-address", *addr, "Optional address of the Omni AVS contract") | ||
} | ||
|
||
func bindDeveloperForgeProjectConfig(cmd *cobra.Command, cfg *developerForgeProjectConfig) { | ||
cmd.Flags().StringVar(&cfg.templateURL, "template", "https://github.com/omni-network/hello-world-template.git", "URL of the forge template to use") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works - that way they can use any template they like. But we could also just use the name of it, and try to fetch |
||
} | ||
|
||
func bindDevnetAVSAllowConfig(cmd *cobra.Command, cfg *devnetAllowConfig) { | ||
bindRPCURL(cmd, &cfg.RPCURL) | ||
bindAVSAddress(cmd, &cfg.AVSAddr) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# 3-Minute Cross-Chain dApp | ||
|
||
This QuickStart guide will run through how to start an Omni cross chain dApp in less than three minutes. | ||
|
||
In this guide you will: | ||
|
||
- Install the Omni CLI, scaffold a new project and run a local devnet | ||
- Deploy contracts using foundry to the local devnet and test their functionality | ||
|
||
## Steps | ||
|
||
### Step 1: Install the Omni CLI | ||
|
||
First, install the Omni CLI by running the following command: | ||
|
||
```bash | ||
curl -sSfL https://raw.githubusercontent.com/omni-network/omni/main/scripts/install_omni_cli.sh | sh -s | ||
``` | ||
|
||
You may otherwise install from source by following the steps shown in the [Omni CLI Tools section](../../tools/cli/cli.md). | ||
|
||
### Step 2: Scaffold a new project | ||
|
||
Next, create a new directory for your project and scaffold a new project using the Omni CLI: | ||
|
||
```bash | ||
mkdir my-omni-dapp | ||
cd my-omni-dapp | ||
omni developer new | ||
``` | ||
|
||
Note: this requires [foundry](https://github.com/foundry-rs/foundry) to be installed on your machine. | ||
|
||
<details> | ||
<summary>Test the Contracts with Forge</summary> | ||
|
||
You can test the contracts with Forge by running the following command: | ||
|
||
```bash | ||
forge test | ||
``` | ||
|
||
</details> | ||
|
||
### Step 3: Run a local devnet | ||
|
||
Start a local devnet by running the following command: | ||
|
||
```bash | ||
omni devnet start | ||
``` | ||
|
||
Note: this requires [Docker](https://docs.docker.com/get-docker/) to be installed on your machine. | ||
|
||
### Step 4: Deploy contracts | ||
|
||
Deploy the contracts to the local devnet using foundry: | ||
|
||
<details> | ||
<summary>Obtaining Parameter Values</summary> | ||
|
||
You can obtain RPC URL values and portal addresses for the running devnet chains by running the following command: | ||
|
||
```bash | ||
omni devnet info | ||
``` | ||
|
||
And you the private key value is the first anvil private key, found by running: | ||
|
||
```bash | ||
anvil | ||
``` | ||
|
||
These values are kept in `./script/bash/.env.example` and are used to deploy the contracts. You can rename the file to `.env` and fill in the values for other networks. | ||
|
||
</details> | ||
|
||
```bash | ||
bash script/bash/deploy.sh | ||
``` | ||
|
||
### Step 5: Perform a Cross-Chain Greet | ||
|
||
You can now perform a cross-rollup greet by running the following command: | ||
|
||
<details> | ||
<summary>Obtaining Deployment Addresses</summary> | ||
|
||
You can obtain the XGreeter deployment addresses from the output of the previous forge script deployment. | ||
|
||
Because the devnet has just been started, the addresses will be the same as the ones shown below: | ||
|
||
```bash | ||
omni_evm: 0x8464135c8F25Da09e49BC8782676a84730C318bC | ||
mock_op: 0x8464135c8F25Da09e49BC8782676a84730C318bC | ||
mock_arb: 0x8464135c8F25Da09e49BC8782676a84730C318bC | ||
``` | ||
|
||
</details> | ||
|
||
```bash | ||
cast send 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 'greet(string)' 'Yay in 3 minutes!' --private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d --rpc-url http://localhost:8001 --value 1ether | ||
``` | ||
|
||
### Step 6: Check the Greet | ||
|
||
You can check the greet has been saved on the Omni EVM global state by running the following command: | ||
|
||
```bash | ||
cast call 0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82 "lastGreet():(uint64,uint256,uint256,address,address,string)" --rpc-url http://localhost:8000 | ||
``` | ||
|
||
### 🎉 Done 🎉 | ||
|
||
You have successfully deployed and interacted with an Omni cross-chain dApp in less than three minutes! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to do this? They're running this on their own machine.
Also if we are askibng for urls shouldnt' ths allow
:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true that was me fighting the pre-commit runner without questioning it