-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update libs * general cleanup * uncomment * more cleanup * use abi.encodeCall, other cleanup * change env var name * fix portal.mockXCall
- Loading branch information
Showing
21 changed files
with
266 additions
and
419 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# anvil account 2 | ||
PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d | ||
|
||
# portal address for CLI devnet | ||
PORTAL_ADDRESS=0xb835dc695c6bfc8373c0d56973b5d9e9b083e97b | ||
|
||
# address of contract deployed with nonce 1 for above PK. | ||
# TODO: don't hardcode this | ||
DEPLOYED_ADDRESS=0x8464135c8F25Da09e49BC8782676a84730C318bC | ||
|
||
GLOBAL_CHAIN_ID=1651 | ||
OP_CHAIN_ID=1655 | ||
ARB_CHAIN_ID=1656 | ||
|
||
OMNI_RPC_URL=http://localhost:8000 | ||
OP_RPC_URL=http://localhost:8001 | ||
ARB_RPC_URL=http://localhost:8002 |
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 |
---|---|---|
@@ -1,34 +1,23 @@ | ||
name: test | ||
|
||
on: workflow_dispatch | ||
|
||
env: | ||
FOUNDRY_PROFILE: ci | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
fail-fast: true | ||
|
||
name: Foundry project | ||
forge-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Foundry | ||
- name: install foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Run Forge build | ||
run: | | ||
forge --version | ||
forge build --sizes | ||
id: build | ||
|
||
- name: Run Forge tests | ||
- name: run forge tests | ||
run: | | ||
forge test -vvv | ||
id: test |
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,32 @@ | ||
ifneq ("$(wildcard .env)","") | ||
include .env | ||
export $(shell sed 's/=.*//' .env) | ||
endif | ||
|
||
help: ## Display this help message | ||
@egrep -h '\s##\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
ensure-deps: | ||
@which omni > /dev/null 2>&1 || { \ | ||
echo "Binary `omni` not found. Installing..."; \ | ||
curl -sSfL https://raw.githubusercontent.com/omni-network/omni/main/scripts/install_omni_cli.sh | sh -s; \ | ||
} | ||
|
||
build: | ||
forge build | ||
|
||
test: | ||
forge test -vvv | ||
|
||
devnet-start: | ||
omni devnet start | ||
|
||
devnet-clean: | ||
omni devnet clean | ||
|
||
deploy: | ||
forge script DeployGreetingBook --broadcast --rpc-url $(OMNI_RPC_URL) --private-key $(PRIVATE_KEY) | ||
forge script DeployGreeter --broadcast --rpc-url $(OP_RPC_URL) --private-key $(PRIVATE_KEY) | ||
forge script DeployGreeter --broadcast --rpc-url $(ARB_RPC_URL) --private-key $(PRIVATE_KEY) | ||
|
||
.PHONY: ensure-deps build test devnet-start devnet-clean deploy |
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 |
---|---|---|
@@ -1,56 +1,33 @@ | ||
# Omni Hello World Template | ||
|
||
This repository serves as a template for Ethereum smart contract development using Foundry, specifically designed for projects intending to utilize the Omni protocol for cross-chain interactions. The template features the `RollupGreeter` and `GlobalGreeter` contracts as examples to demonstrate how contracts can interact across different blockchain networks. | ||
This repository serves as a template for Ethereum smart contract development using Foundry, specifically designed for projects intending to utilize the Omni protocol for cross-chain interactions. The template features the `Greeter` and `GreetingBook` contracts as examples to demonstrate how contracts can interact across different blockchain networks. | ||
|
||
## Getting Started | ||
## Installation | ||
|
||
To use this template for your project, initialize a new project with Foundry by running the following within your project directory: | ||
To use this template for your project, initialize a new project either by using `forge init` or cloning this repo:: | ||
|
||
```bash | ||
forge init --template https://github.com/omni-network/hello-world-template.git | ||
``` | ||
|
||
### Cloning the Template | ||
|
||
To clone this template along with its dependencies, use the following command: | ||
|
||
```bash | ||
git clone --recursive https://github.com/omni-network/hello-world-template.git | ||
``` | ||
|
||
If you've already cloned the repository without submodules, initialize and update them with: | ||
|
||
```bash | ||
git submodule update --init --recursive | ||
``` | ||
|
||
## Compiling Contracts | ||
|
||
After initializing your project with this template, compile the smart contracts using: | ||
|
||
```bash | ||
forge build | ||
``` | ||
|
||
## Running Tests | ||
## Usage | ||
|
||
This template includes tests for the `XGreeter` contract. Run these tests to ensure everything is set up correctly: | ||
|
||
```bash | ||
forge test | ||
``` | ||
1. Run `make build` to build the smart contracts. | ||
2. Run `make test` to run tests. | ||
|
||
## Contributing | ||
If you want to deploy the contracts agains a local devnet: | ||
|
||
Contributions to this template are welcome. To contribute: | ||
1. Run `make ensure-deps` to ensure you've installed the `omni` cli. | ||
2. Run `make devnet-start` to deploy a local instance of Omni, which includes local deployments of Omni, Arbitrum, and Optimism. | ||
3. Run `make deploy` to deploy your smart contracts. | ||
|
||
1. Fork the repository. | ||
2. Create a new branch for your feature (`git checkout -b feature/amazing-feature`). | ||
3. Commit your changes (`git commit -am 'feat(dir): Add some amazing feature'`). | ||
4. Push to the branch (`git push origin feature/amazing-feature`). | ||
5. Open a pull request. | ||
Note: you'll need to have docker installed to run the local devnet. | ||
|
||
## Acknowledgments | ||
When finished, you can run: | ||
|
||
- This template is designed for developers looking to explore cross-chain capabilities with the Omni protocol. | ||
- Special thanks to the Foundry team for providing such a powerful tool for smart contract development. | ||
`make devnet-clean` |
Submodule forge-std
updated
10 files
+1 −1 | package.json | |
+1 −8 | src/StdChains.sol | |
+0 −9 | src/StdInvariant.sol | |
+1 −1 | src/StdStorage.sol | |
+1 −86 | src/Vm.sol | |
+382 −401 | src/console.sol | |
+1,555 −1 | src/console2.sol | |
+0 −3 | test/StdChains.t.sol | |
+0 −8 | test/StdStorage.t.sol | |
+2 −2 | test/Vm.t.sol |
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,18 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.23; | ||
|
||
import {Script, console} from "forge-std/Script.sol"; | ||
import {Greeter} from "src/Greeter.sol"; | ||
|
||
contract DeployGreeter is Script { | ||
function run() external { | ||
address portalAddress = vm.envAddress("PORTAL_ADDRESS"); | ||
address greetingBookAddress = vm.envAddress("DEPLOYED_ADDRESS"); | ||
|
||
vm.startBroadcast(); | ||
Greeter greeter = new Greeter(portalAddress, greetingBookAddress); | ||
vm.stopBroadcast(); | ||
|
||
console.log("Deployed Greeter at:", address(greeter)); | ||
} | ||
} |
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,18 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.23; | ||
|
||
import {Script, console} from "forge-std/Script.sol"; | ||
import {GreetingBook} from "src/GreetingBook.sol"; | ||
|
||
|
||
contract DeployGreetingBook is Script { | ||
function run() external { | ||
address portalAddress = vm.envAddress("PORTAL_ADDRESS"); | ||
|
||
vm.startBroadcast(); | ||
GreetingBook greetingBook = new GreetingBook(portalAddress); | ||
vm.stopBroadcast(); | ||
|
||
console.log("Deployed GreetingBook at:", address(greetingBook)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.