Skip to content
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(evm-forge): foundry support and template for Nibiru EVM develoment #2084

Merged
merged 5 commits into from
Oct 22, 2024
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/e2e-evm.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: EVM e2e tests
name: EVM E2E tests

on:
pull_request:
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:

- name: "just install"
run: just install
working-directory: "e2e/evm"
working-directory: "evm-e2e"

- name: "Launch localnet"
run: |
Expand All @@ -78,7 +78,7 @@ jobs:

- name: "Run tests (just test)"
run: just test
working-directory: "e2e/evm"
working-directory: "evm-e2e"
env:
JSON_RPC_ENDPOINT: http://127.0.0.1:8545
MNEMONIC: guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host
2 changes: 1 addition & 1 deletion .github/workflows/e2e-wasm.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CosmWasm e2e tests
name: Wasm E2E tests

on:
# On normal PRs or when workflow goreleaser finishes, as it gets the last release tag.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Use effective gas price in RefundGas and make sure that units are properly
reflected on all occurences of "base fee" in the codebase. This fixes [#2059](https://github.com/NibiruChain/nibiru/issues/2059)
and the [related comments from @Unique-Divine and @berndartmueller](https://github.com/NibiruChain/nibiru/issues/2059#issuecomment-2408625724).
- [#2084](https://github.com/NibiruChain/nibiru/pull/2084) - feat(evm-forge): foundry support and template for Nibiru EVM develoment
- [#2088](https://github.com/NibiruChain/nibiru/pull/2088) - refactor(evm): remove outdated comment and improper error message text


Expand Down
64 changes: 0 additions & 64 deletions docs/adr/00-adr-template.md

This file was deleted.

107 changes: 0 additions & 107 deletions docs/adr/01-adr-msg-server-keeper.md

This file was deleted.

50 changes: 0 additions & 50 deletions docs/adr/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* accordingly.
*
* The methods tested are from the smart contract,
* "e2e/evm/contracts/SendReceiveNibi.sol".
* "evm-e2e/contracts/SendReceiveNibi.sol".
*/
import { describe, expect, it } from "@jest/globals"
import { parseEther, toBigInt, Wallet } from "ethers"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions evm-forge/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig http://EditorConfig.org

# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.sol]
indent_size = 4

[*.tree]
indent_size = 1
11 changes: 11 additions & 0 deletions evm-forge/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export API_KEY_ALCHEMY="YOUR_API_KEY_ALCHEMY"
export API_KEY_ARBISCAN="YOUR_API_KEY_ARBISCAN"
export API_KEY_BSCSCAN="YOUR_API_KEY_BSCSCAN"
export API_KEY_ETHERSCAN="YOUR_API_KEY_ETHERSCAN"
export API_KEY_GNOSISSCAN="YOUR_API_KEY_GNOSISSCAN"
export API_KEY_INFURA="YOUR_API_KEY_INFURA"
export API_KEY_OPTIMISTIC_ETHERSCAN="YOUR_API_KEY_OPTIMISTIC_ETHERSCAN"
export API_KEY_POLYGONSCAN="YOUR_API_KEY_POLYGONSCAN"
export API_KEY_SNOWTRACE="YOUR_API_KEY_SNOWTRACE"
export MNEMONIC="YOUR_MNEMONIC"
export FOUNDRY_PROFILE="default"
2 changes: 2 additions & 0 deletions evm-forge/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
custom: "https://3cities.xyz/#/pay?c=CAESFAKY9DMuOFdjE4Wzl2YyUFipPiSfIgICATICCAJaFURvbmF0aW9uIHRvIFBhdWwgQmVyZw"
github: "PaulRBerg"
38 changes: 38 additions & 0 deletions evm-forge/.github/scripts/rename.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# https://gist.github.com/vncsna/64825d5609c146e80de8b1fd623011ca
set -euo pipefail

# Define the input vars
GITHUB_REPOSITORY=${1?Error: Please pass username/repo, e.g. prb/foundry-template}
GITHUB_REPOSITORY_OWNER=${2?Error: Please pass username, e.g. prb}
GITHUB_REPOSITORY_DESCRIPTION=${3:-""} # If null then replace with empty string

echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
echo "GITHUB_REPOSITORY_OWNER: $GITHUB_REPOSITORY_OWNER"
echo "GITHUB_REPOSITORY_DESCRIPTION: $GITHUB_REPOSITORY_DESCRIPTION"

# jq is like sed for JSON data
JQ_OUTPUT=`jq \
--arg NAME "@$GITHUB_REPOSITORY" \
--arg AUTHOR_NAME "$GITHUB_REPOSITORY_OWNER" \
--arg URL "https://github.com/$GITHUB_REPOSITORY_OWNER" \
--arg DESCRIPTION "$GITHUB_REPOSITORY_DESCRIPTION" \
'.name = $NAME | .description = $DESCRIPTION | .author |= ( .name = $AUTHOR_NAME | .url = $URL )' \
package.json
`

# Overwrite package.json
echo "$JQ_OUTPUT" > package.json

# Make sed command compatible in both Mac and Linux environments
# Reference: https://stackoverflow.com/a/38595160/8696958
sedi () {
sed --version >/dev/null 2>&1 && sed -i -- "$@" || sed -i "" "$@"
}

# Rename instances of "PaulRBerg/foundry-template" to the new repo name in README.md for badges only
sedi "/gitpod/ s|PaulRBerg/foundry-template|"${GITHUB_REPOSITORY}"|;" "README.md"
sedi "/gitpod-badge/ s|PaulRBerg/foundry-template|"${GITHUB_REPOSITORY}"|;" "README.md"
sedi "/gha/ s|PaulRBerg/foundry-template|"${GITHUB_REPOSITORY}"|;" "README.md"
sedi "/gha-badge/ s|PaulRBerg/foundry-template|"${GITHUB_REPOSITORY}"|;" "README.md"
Comment on lines +34 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix quoting in sed commands to prevent unintended word splitting.

The sedi commands are correctly targeting the specific lines in the README.md file. However, there's a potential issue with the quoting of variables.

To address the Shellcheck warnings and prevent potential word splitting or globbing, modify the sedi commands as follows:

sedi "/gitpod/ s|PaulRBerg/foundry-template|${GITHUB_REPOSITORY}|;" "README.md"
sedi "/gitpod-badge/ s|PaulRBerg/foundry-template|${GITHUB_REPOSITORY}|;" "README.md"
sedi "/gha/ s|PaulRBerg/foundry-template|${GITHUB_REPOSITORY}|;" "README.md"
sedi "/gha-badge/ s|PaulRBerg/foundry-template|${GITHUB_REPOSITORY}|;" "README.md"

This change ensures that the ${GITHUB_REPOSITORY} variable is properly expanded within the sed command.

🧰 Tools
🪛 Shellcheck

[warning] 35-35: The surrounding quotes actually unquote this. Remove or escape them.

(SC2027)


[warning] 36-36: The surrounding quotes actually unquote this. Remove or escape them.

(SC2027)


[warning] 37-37: The surrounding quotes actually unquote this. Remove or escape them.

(SC2027)


[warning] 38-38: The surrounding quotes actually unquote this. Remove or escape them.

(SC2027)

Loading
Loading