Skip to content

Commit ee21688

Browse files
feat(target_chains/ethereum): add arbirum stylus sdk (#2041)
* chore: init stylus project * chore: added scripts * chore: created workspace * chore: docs setup * chore: pyth contracts init * chore: docs command setup * mock: example project * chore : created test workspace * chore: changed toml version * chore: created mock pyth workspace * chore: renamed project sdk * chore: refactored files * chore : helpers functions * refacor : refactord code * chore: removed struct type , implemented abstract_pyth * chore: created storage price and storage price feed * chore: integrating storage price and storage price feed * chore: fixed error created by storage type * chore: config changes * chore: forge init * forge install: forge-std v1.9.3 * mock pyth : created mock solidity pyth contract * chore: Renamed MockPyth Scripts * chore: started testing * chore: removed projects * feture :completed unit test and stylus contracts * added initializtion for mock * examples setup * chore:fixed imports * chore:fixed types * completed contract * External call and fution call sample * chore: Changed motsu * chore: Created Proxy call example * feture: Example for both type of call * chore: Added beches * Lib Changes * chore:Scripts modifications * chore : fuction call and proxy call * chore: added workflow * chore: doc pages docs * chore: doc changes * smaller chages * chore: benches and toml changes * chore: added foundry to e2e workflow * chore:set up benchmark * Added Benches * chore:added setup mock pyth script to bench and e2e and logs * changes * feture: Added Proxy call to bench * chore: Removed sol file * Added deploy scripts * chore: proxy calls * chore: removed file * changes * chore:added constructor file and worked on bench * chore: moved Ipyth to pyth-contract file * chore: added variable to bash scripts * chore:decode and encode helper * chore: fixed mock pyth deploy script * chore: removed dotenv crates * chore: completed benches functions * chore: examples and proxy call fixes * changes * chore: added create functions * chore: completed get data benchmarks * chore:contract changes * chore:function calls * chore: Ignore all broadcast * chore: completed get benches * chore:changes * chore: Added Type Test * chore: tests * env and examples * Update README.md * Update README.md * Update README.md * chore: worked on bench and e2e test * removed log * chore: completed e2e test for function call example * chore : changed pyth script * chore:completed e2e test * chore:benches * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * chore: removed docs * Update README.md * Update README.md * Update CODEOWNERS * Delete target_chains/ethereum/sdk/stylus/SECURITY.md * Delete target_chains/ethereum/sdk/stylus/lib/crypto directory * Delete target_chains/ethereum/sdk/stylus/.linkspector.yml * Delete target_chains/ethereum/sdk/stylus/netlify.toml * Update Cargo.toml removed openzepline crypto * Update README.md * Delete target_chains/ethereum/sdk/stylus/pyth-solidity/.env.example * Update gas-bench.yml * chore:removed a bunch of openzeplin files * chore: removed workflow * chore:Added Guidlines * chore: motsu changes * Create Test.md * Update Test.md * Rename Test.md to TEST.md * Update README.md * Update README.md * Update README.md * Delete target_chains/ethereum/sdk/stylus/TEST.md * chore: removed mostu * chore: changed Fixedbytes<32> to B256 * chore: removed local e2e testing library * chore: changes * forge install: forge-std v1.9.4 * forge install: openzeppelin-foundry-upgrades v0.3.6 * forge install: openzeppelin-contracts v4.9.6 * chore: formated code * chore: fixed scripts * Update target_chains/ethereum/sdk/stylus/README.md Co-authored-by: Pavel Strakhov <[email protected]> * Update target_chains/ethereum/sdk/stylus/README.md Co-authored-by: Pavel Strakhov <[email protected]> * chore: rustfmt changes * chore: changed solidity licenses to Apache 2 * chore: deleted codeowner file and link * chore: removed comments * solidity changes * chore: removed folder * chore: removed = for version * forge install: forge-std v1.9.4 * forge install: openzeppelin-foundry-upgrades v0.3.6 * forge install: openzeppelin-contracts-upgradeable v4.9.6 * chore: Remove MIT license * chore: script changes * chore: removed dependices * forge install: forge-std v1.9.4 * forge install: openzeppelin-foundry-upgrades v0.3.6 * chore:added description to script * Update target_chains/ethereum/sdk/stylus/README.md Co-authored-by: Pavel Strakhov <[email protected]> * Update target_chains/ethereum/sdk/stylus/README.md Co-authored-by: Pavel Strakhov <[email protected]> * Update target_chains/ethereum/sdk/stylus/contracts/src/pyth/mod.rs Co-authored-by: Pavel Strakhov <[email protected]> * Update target_chains/ethereum/sdk/stylus/contracts/src/pyth/errors.rs Co-authored-by: Pavel Strakhov <[email protected]> * chore: changed // to /// and remove licenses because of root licenese * chore: Apache-2.0 license * chore: renamed file name pyth-solidity to pyth-mock-solidity * chore: removed commented code * chore: foundry test workflow * chore: workflows * chore: changed readme to rust * chore: fixed description mock solidity * chore: fixed zero case * chore: change all use case of gt and lt to > and < * chore: workflow * chore: replaced the file with the link * chore: refactor and removed unused code * chore: renamed function for test * chore: added some sort of path filters * chore: add cargo fmt and cargo clippy for stylus sdk * chore: package-json.lock moved depencies to pnpm-workspace.yaml * chore:test attribute * chore: git workflows * chore: removed functions example * chore: switch for item in update_data * chore: fixed example * chore: refactor examples * cargo changes * chore: pyth example , and function call example * chore: added other example * chore: install * chore:installations * chore: mock pyth * chore: benches and test * smaller changes * chore: mock * chore: bench format * chore: code format * chore: code format * chore: removed workflow * chore: pnpm install * chore: removed package-lock.json * chore: fixed commented out job * chore: ran pre-commit run --all * chore: pre-commit run --all * chore:removed space * Update .github/workflows/cli-foundry-test.yml Co-authored-by: Pavel Strakhov <[email protected]> * chore:removed space chore: vec changes * chore: data changes * Update .github/workflows/cli-stylus-nostd.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-gas-bench.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-e2e-tests.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-check.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-check-wasm.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-foundry-test.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-e2e-tests.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-check-wasm.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-check.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-nostd.yml Co-authored-by: Pavel Strakhov <[email protected]> * Update .github/workflows/cli-stylus-gas-bench.yml Co-authored-by: Pavel Strakhov <[email protected]> * chore: added back existing submodule * chore: data changes * cl fixes * cli fixes * chore: toolchain: nightly-2024-01-01 * chore: version changes * toolchain * removed typo workflow * fixed rust issue * changed rust version * added foundry * chore: changes * chore:bench fixes * chore: changed cli workflow * chore: format * ci changes * chore: added space * precommit fixes * added new line * removed * removed line * chore: ci changes * chore : changes * changed ci script * removed if statements for test * chore: changes * chore:fixes * chore: fixes * chore: fixes * added evm file * chore: checking key * testing keys * remove comand * precommit fixes * chore: removed workflow * cl changes * fmt * fixed verion issue --------- Co-authored-by: Pavel Strakhov <[email protected]>
1 parent 032f98f commit ee21688

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+7851
-0
lines changed

.github/workflows/ci-foundry-test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: stylus-foundry-test
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- target_chains/ethereum/sdk/stylus/**
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- target_chains/ethereum/sdk/stylus/**
12+
env:
13+
FOUNDRY_PROFILE: ci
14+
jobs:
15+
check:
16+
name: Foundry project
17+
runs-on: ubuntu-latest
18+
defaults:
19+
run:
20+
working-directory: target_chains/ethereum/sdk/stylus
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: recursive
26+
- name: Install Foundry
27+
uses: foundry-rs/foundry-toolchain@v1
28+
with:
29+
version: nightly
30+
- name: Show Forge version
31+
run: forge --version
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: stylus-check-wasm
2+
# This workflow checks that the compiled wasm binary of every example contract
3+
# can be deployed to Arbitrum Stylus.
4+
on:
5+
pull_request:
6+
paths:
7+
- target_chains/ethereum/sdk/stylus/**
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- target_chains/ethereum/sdk/stylus/**
13+
permissions:
14+
contents: read
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
env:
19+
CARGO_TERM_COLOR: always
20+
jobs:
21+
check-wasm:
22+
name: Check WASM binary
23+
runs-on: ubuntu-latest
24+
defaults:
25+
run:
26+
working-directory: target_chains/ethereum/sdk/stylus
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Install rust
30+
uses: actions-rust-lang/setup-rust-toolchain@v1
31+
with:
32+
rustflags: ""
33+
- name: Install Foundry
34+
uses: foundry-rs/foundry-toolchain@v1
35+
with:
36+
version: nightly
37+
- name: Install cargo-stylus
38+
run: cargo install [email protected]
39+
- name: Run wasm check
40+
run: ./scripts/check-wasm.sh

.github/workflows/ci-stylus-check.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: stylus-check
2+
# This workflow runs whenever a PR is opened or updated, or a commit is pushed
3+
# to main. It runs several checks:
4+
# - fmt: checks that the code is formatted according to `rustfmt`.
5+
# - clippy: checks that the code does not contain any `clippy` warnings.
6+
# - doc: checks that the code can be documented without errors.
7+
# - hack: check combinations of feature flags.
8+
# - typos: checks for typos across the repo.
9+
permissions:
10+
contents: read
11+
# This configuration allows maintainers of this repo to create a branch and
12+
# pull request based on the new branch. Restricting the push trigger to the
13+
# main branch ensures that the PR only gets built once.
14+
on:
15+
pull_request:
16+
paths:
17+
- target_chains/ethereum/sdk/stylus/**
18+
push:
19+
branches:
20+
- main
21+
paths:
22+
- target_chains/ethereum/sdk/stylus/**
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
25+
cancel-in-progress: true
26+
env:
27+
CARGO_TERM_COLOR: always
28+
jobs:
29+
fmt:
30+
runs-on: ubuntu-latest
31+
name: nightly / fmt
32+
defaults:
33+
run:
34+
working-directory: target_chains/ethereum/sdk/stylus
35+
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
submodules: true
39+
40+
- name: Install rust
41+
# We run in nightly to make use of some features only available there.
42+
# Check out `rustfmt.toml` to see which ones.
43+
uses: actions-rust-lang/setup-rust-toolchain@v1
44+
with:
45+
toolchain: nightly
46+
components: rustfmt
47+
rustflags: ""
48+
49+
- name: Check formatting
50+
run: cargo fmt --all --check
51+
clippy:
52+
runs-on: ubuntu-latest
53+
name: ${{ matrix.toolchain }} / clippy
54+
defaults:
55+
run:
56+
working-directory: target_chains/ethereum/sdk/stylus
57+
permissions:
58+
contents: read
59+
checks: write
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
# Get early warning of new lints which are regularly introduced in beta
64+
# channels.
65+
toolchain: [stable, beta]
66+
steps:
67+
- uses: actions/checkout@v4
68+
with:
69+
submodules: true
70+
- name: Install rust ${{ matrix.toolchain }}
71+
uses: actions-rust-lang/setup-rust-toolchain@v1
72+
with:
73+
toolchain: ${{ matrix.toolchain }}
74+
components: clippy
75+
rustflags: ""

.github/workflows/ci-stylus-nostd.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This workflow checks whether the library is able to run without the std
2+
# library. See `check.yml` for information about how the concurrency
3+
# cancellation and workflow triggering works.
4+
name: stylus-no-std
5+
permissions:
6+
contents: read
7+
on:
8+
pull_request:
9+
paths:
10+
- target_chains/ethereum/sdk/stylus/**
11+
push:
12+
branches:
13+
- main
14+
paths:
15+
- target_chains/ethereum/sdk/stylus/**
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
env:
20+
CARGO_TERM_COLOR: always
21+
jobs:
22+
nostd:
23+
runs-on: ubuntu-latest
24+
name: ${{ matrix.target }}
25+
defaults:
26+
run:
27+
working-directory: target_chains/ethereum/sdk/stylus
28+
strategy:
29+
matrix:
30+
target: [wasm32-unknown-unknown]
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
submodules: true
35+
- name: Install rust
36+
uses: actions-rust-lang/setup-rust-toolchain@v1
37+
with:
38+
toolchain: stable
39+
rustflags: ""
40+
- name: Add rust targets ${{ matrix.target }}
41+
run: rustup target add ${{ matrix.target }}
42+
- name: Cargo check
43+
run: cargo check --release --target ${{ matrix.target }} --no-default-features
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish Pyth Stylus SDK to crates.io
2+
3+
on:
4+
push:
5+
tags:
6+
- pythnet-stylus-sdk-v*
7+
jobs:
8+
publish-pythnet-stylus-sdk:
9+
name: Publish Pythnet Stylus SDK
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout sources
13+
uses: actions/checkout@v2
14+
15+
- run: cargo publish --token ${CARGO_REGISTRY_TOKEN}
16+
env:
17+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
18+
working-directory: target_chains/ethereum/sdk/stylus

.gitmodules

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,21 @@
1010
[submodule "lazer/contracts/evm/lib/createx"]
1111
path = lazer/contracts/evm/lib/createx
1212
url = https://github.com/pcaversaccio/createx
13+
[submodule "lib/forge-std"]
14+
path = lib/forge-std
15+
url = https://github.com/foundry-rs/forge-std
16+
[submodule "lib/openzeppelin-foundry-upgrades"]
17+
path = lib/openzeppelin-foundry-upgrades
18+
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades
19+
[submodule "lib/openzeppelin-contracts-upgradeable"]
20+
path = lib/openzeppelin-contracts-upgradeable
21+
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
22+
[submodule "target_chains/ethereum/sdk/stylus/pyth-mock-solidity/lib/forge-std"]
23+
path = target_chains/ethereum/sdk/stylus/pyth-mock-solidity/lib/forge-std
24+
url = https://github.com/foundry-rs/forge-std
25+
[submodule "target_chains/ethereum/sdk/stylus/pyth-mock-solidity/lib/openzeppelin-foundry-upgrades"]
26+
path = target_chains/ethereum/sdk/stylus/pyth-mock-solidity/lib/openzeppelin-foundry-upgrades
27+
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades
28+
[submodule "target_chains/ethereum/sdk/stylus/pyth-mock-solidity/lib/openzeppelin-contracts-upgradeable"]
29+
path = target_chains/ethereum/sdk/stylus/pyth-mock-solidity/lib/openzeppelin-contracts-upgradeable
30+
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,15 @@ repos:
139139
entry: cargo +1.82.0 clippy --manifest-path ./lazer/Cargo.toml --all-targets -- --deny warnings
140140
pass_filenames: false
141141
files: lazer
142+
- id: cargo-fmt-stylus-sdk
143+
name: Cargo format for Stylus SDK
144+
language: "rust"
145+
entry: cargo +1.82.0 fmt --manifest-path ./target_chains/ethereum/sdk/stylus/Cargo.toml --all
146+
pass_filenames: false
147+
files: target_chains/ethereum/sdk/stylus
148+
- id: cargo-clippy-stylus-sdk
149+
name: Cargo clippy for Stylus SDK
150+
language: "rust"
151+
entry: cargo +1.82.0 clippy --manifest-path ./target_chains/ethereum/sdk/stylus/Cargo.toml --all-targets -- --deny warnings
152+
pass_filenames: false
153+
files: target_chains/ethereum/sdk/stylus

lib/forge-std

Submodule forge-std added at 1eea5ba

0 commit comments

Comments
 (0)