This repository was archived by the owner on Aug 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
Feature: L1 <> L2 messaging with Token Bridge example #253
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
5f8715a
Add token bridge scaffold
0xNeshi 33188fc
Create L2 bridge
0xNeshi 251ff2c
Add tests for L2 bridge
0xNeshi 5b507bb
Add solidity bridge contract
0xNeshi b4e93b5
rename consumeMessage->consumeWithdrawal & initiateWithdrawal->bridge…
0xNeshi bbf3a56
Rename initiate_withdrawal->bridge_to_l1
0xNeshi 7efed11
make TokenBridge work + add tests
0xNeshi 1936c31
Add ability to set l2bridge post deployment
0xNeshi 8bc413f
Add ability to set l1bridge and token post deployment to cairo
0xNeshi 8cd9ff3
Add getters + pass governor in ctor
0xNeshi db4565a
Split uint256 amount to low/high before bridging to L2
0xNeshi f4d5687
TokenBridge: remove token from ctor + token ops limited to bridge
0xNeshi ad6fcae
Move starknet contracts to lib
0xNeshi 09a3ff0
leave source to orig strk mess local
0xNeshi 08a0a14
make l2 handler selector customizable
0xNeshi 8fa90a1
manually set token and l1 bridge address in STRK
0xNeshi 0170de5
MintableTokenMock: OnlyBridge->Unauthorized
0xNeshi 195bb71
Strk: set token post-ctor + add missing mock token
0xNeshi f9ca0f6
add comments to contract.cairo
0xNeshi 28bac93
Remove cache and out from solidity
0xNeshi 4602eef
move ./cairo contents to root folder
0xNeshi 30ed1c7
mintableToken->token
0xNeshi c018053
Merge remote-tracking branch 'origin/main' into l1-l2-token-bridge
0xNeshi 5813aaf
Remove redundant l1_bridge felt252 init in tests
0xNeshi 3d18859
mocks.cairo->mintable_token_mock.cairo
0xNeshi b8b57e1
Update the .md file
0xNeshi 8e0c198
remove TokenBridge @author tag
0xNeshi 8a1ea4c
Merge remote-tracking branch 'origin/main' into l1-l2-token-bridge
0xNeshi 6ce10e8
Update edition to point to workspace
0xNeshi badf4db
Prepare release 2.8.2 (#257)
julio4 615a273
fix(app): correct sidebar placement
julio4 c390ac7
fix(app): responsive content centering
julio4 a87235b
fix(app): responsive content centering
julio4 273e2a6
Update issue templates, Close #273
julio4 7567721
merge with upstream/dev
0xNeshi a698209
add missing edition to CONTRITUTING > adding new cairo program
0xNeshi 8392d60
remove src/SUMMARY
0xNeshi 8880678
fix typos
0xNeshi 4d4c4ad
fix typos target in CONTRIBUTING example
0xNeshi aba6d04
fix test path to MintableTokenMock
0xNeshi c2b1304
Merge branch 'dev' into l1-l2-token-bridge
0xNeshi 54873ae
revert changes to pnpm-lock
0xNeshi 36d85c8
remove openzeppelin dep
0xNeshi 5942513
fix fmt errors in tests
0xNeshi fff57c8
fix fmt errors contract.cairo
0xNeshi 582e875
remove redundant comma
0xNeshi 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 hidden or 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 hidden or 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 hidden or 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,2 @@ | ||
| target | ||
| .snfoundry_cache/ |
This file contains hidden or 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,16 @@ | ||
| [package] | ||
| name = "l1_l2_token_bridge" | ||
| version.workspace = true | ||
| edition.workspace = true | ||
|
|
||
| [dependencies] | ||
| starknet.workspace = true | ||
|
|
||
| [dev-dependencies] | ||
| assert_macros.workspace = true | ||
| snforge_std.workspace = true | ||
|
|
||
| [scripts] | ||
| test.workspace = true | ||
|
|
||
| [[target.starknet-contract]] |
This file contains hidden or 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,2 @@ | ||
| cache | ||
| out |
66 changes: 66 additions & 0 deletions
66
listings/applications/l1_l2_token_bridge/solidity/README.md
This file contains hidden or 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,66 @@ | ||
| ## Foundry | ||
|
|
||
| **Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** | ||
|
|
||
| Foundry consists of: | ||
|
|
||
| - **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). | ||
| - **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. | ||
| - **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. | ||
| - **Chisel**: Fast, utilitarian, and verbose solidity REPL. | ||
|
|
||
| ## Documentation | ||
|
|
||
| https://book.getfoundry.sh/ | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Build | ||
|
|
||
| ```shell | ||
| $ forge build | ||
| ``` | ||
|
|
||
| ### Test | ||
|
|
||
| ```shell | ||
| $ forge test | ||
| ``` | ||
|
|
||
| ### Format | ||
|
|
||
| ```shell | ||
| $ forge fmt | ||
| ``` | ||
|
|
||
| ### Gas Snapshots | ||
|
|
||
| ```shell | ||
| $ forge snapshot | ||
| ``` | ||
|
|
||
| ### Anvil | ||
|
|
||
| ```shell | ||
| $ anvil | ||
| ``` | ||
|
|
||
| ### Deploy | ||
|
|
||
| ```shell | ||
| $ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> | ||
| ``` | ||
|
|
||
| ### Cast | ||
|
|
||
| ```shell | ||
| $ cast <subcommand> | ||
| ``` | ||
|
|
||
| ### Help | ||
|
|
||
| ```shell | ||
| $ forge --help | ||
| $ anvil --help | ||
| $ cast --help | ||
| ``` |
7 changes: 7 additions & 0 deletions
7
listings/applications/l1_l2_token_bridge/solidity/foundry.toml
This file contains hidden or 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,7 @@ | ||
| [profile.default] | ||
| src = "src" | ||
| out = "out" | ||
| libs = ["lib"] | ||
|
|
||
| # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options | ||
| remappings = ["starknet/=lib/starknet/"] |
1 change: 1 addition & 0 deletions
1
listings/applications/l1_l2_token_bridge/solidity/lib/forge-std/.gitattributes
This file contains hidden or 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 @@ | ||
| src/Vm.sol linguist-generated | ||
128 changes: 128 additions & 0 deletions
128
listings/applications/l1_l2_token_bridge/solidity/lib/forge-std/.github/workflows/ci.yml
This file contains hidden or 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,128 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: nightly | ||
|
|
||
| - name: Print forge version | ||
| run: forge --version | ||
|
|
||
| # Backwards compatibility checks: | ||
| # - the oldest and newest version of each supported minor version | ||
| # - versions with specific issues | ||
| - name: Check compatibility with latest | ||
| if: always() | ||
| run: | | ||
| output=$(forge build --skip test) | ||
| if echo "$output" | grep -q "Warning"; then | ||
| echo "$output" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check compatibility with 0.8.0 | ||
| if: always() | ||
| run: | | ||
| output=$(forge build --skip test --use solc:0.8.0) | ||
| if echo "$output" | grep -q "Warning"; then | ||
| echo "$output" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check compatibility with 0.7.6 | ||
| if: always() | ||
| run: | | ||
| output=$(forge build --skip test --use solc:0.7.6) | ||
| if echo "$output" | grep -q "Warning"; then | ||
| echo "$output" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check compatibility with 0.7.0 | ||
| if: always() | ||
| run: | | ||
| output=$(forge build --skip test --use solc:0.7.0) | ||
| if echo "$output" | grep -q "Warning"; then | ||
| echo "$output" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check compatibility with 0.6.12 | ||
| if: always() | ||
| run: | | ||
| output=$(forge build --skip test --use solc:0.6.12) | ||
| if echo "$output" | grep -q "Warning"; then | ||
| echo "$output" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check compatibility with 0.6.2 | ||
| if: always() | ||
| run: | | ||
| output=$(forge build --skip test --use solc:0.6.2) | ||
| if echo "$output" | grep -q "Warning"; then | ||
| echo "$output" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # via-ir compilation time checks. | ||
| - name: Measure compilation time of Test with 0.8.17 --via-ir | ||
| if: always() | ||
| run: forge build --skip test --contracts test/compilation/CompilationTest.sol --use solc:0.8.17 --via-ir | ||
|
|
||
| - name: Measure compilation time of TestBase with 0.8.17 --via-ir | ||
| if: always() | ||
| run: forge build --skip test --contracts test/compilation/CompilationTestBase.sol --use solc:0.8.17 --via-ir | ||
|
|
||
| - name: Measure compilation time of Script with 0.8.17 --via-ir | ||
| if: always() | ||
| run: forge build --skip test --contracts test/compilation/CompilationScript.sol --use solc:0.8.17 --via-ir | ||
|
|
||
| - name: Measure compilation time of ScriptBase with 0.8.17 --via-ir | ||
| if: always() | ||
| run: forge build --skip test --contracts test/compilation/CompilationScriptBase.sol --use solc:0.8.17 --via-ir | ||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: nightly | ||
|
|
||
| - name: Print forge version | ||
| run: forge --version | ||
|
|
||
| - name: Run tests | ||
| run: forge test -vvv | ||
|
|
||
| fmt: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: nightly | ||
|
|
||
| - name: Print forge version | ||
| run: forge --version | ||
|
|
||
| - name: Check formatting | ||
| run: forge fmt --check |
31 changes: 31 additions & 0 deletions
31
listings/applications/l1_l2_token_bridge/solidity/lib/forge-std/.github/workflows/sync.yml
This file contains hidden or 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,31 @@ | ||
| name: Sync Release Branch | ||
|
|
||
| on: | ||
| release: | ||
| types: | ||
| - created | ||
|
|
||
| jobs: | ||
| sync-release-branch: | ||
| runs-on: ubuntu-latest | ||
| if: startsWith(github.event.release.tag_name, 'v1') | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: v1 | ||
|
|
||
| # The email is derived from the bots user id, | ||
| # found here: https://api.github.com/users/github-actions%5Bbot%5D | ||
| - name: Configure Git | ||
| run: | | ||
| git config user.name github-actions[bot] | ||
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
| - name: Sync Release Branch | ||
| run: | | ||
| git fetch --tags | ||
| git checkout v1 | ||
| git reset --hard ${GITHUB_REF} | ||
| git push --force |
4 changes: 4 additions & 0 deletions
4
listings/applications/l1_l2_token_bridge/solidity/lib/forge-std/.gitignore
This file contains hidden or 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,4 @@ | ||
| cache/ | ||
| out/ | ||
| .vscode | ||
| .idea |
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.
Uh oh!
There was an error while loading. Please reload this page.