-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into superfluffy/bech32-addresses
- Loading branch information
Showing
97 changed files
with
3,417 additions
and
690 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
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,3 @@ | ||
[submodule "crates/astria-bridge-withdrawer/ethereum/lib/forge-std"] | ||
path = crates/astria-bridge-withdrawer/ethereum/lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,6 +1,6 @@ | ||
dependencies: | ||
- name: sequencer-relayer | ||
repository: file://../sequencer-relayer | ||
version: 0.8.1 | ||
digest: sha256:aea57e7ee44fd5bf1c851792b6a540a222d76a91518948f2b609966a65f694c4 | ||
generated: "2024-05-24T10:23:31.097578-07:00" | ||
version: 0.8.3 | ||
digest: sha256:5299fcd71b8cac0aa3929a00830fa682d04d239700664a644b3010980704e867 | ||
generated: "2024-05-28T13:16:38.413956-07:00" |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
[package] | ||
name = "astria-bridge-withdrawer" | ||
version = "0.1.0" | ||
edition = "2021" | ||
rust-version = "1.73" | ||
license = "MIT OR Apache-2.0" | ||
readme = "README.md" | ||
repository = "https://github.com/astriaorg/astria" | ||
homepage = "https://astria.org" | ||
|
||
[[bin]] | ||
name = "astria-bridge-withdrawer" | ||
|
||
[dependencies] | ||
http = "0.2.9" | ||
|
||
axum = { workspace = true } | ||
futures = { workspace = true } | ||
hex = { workspace = true } | ||
ethers = { workspace = true, features = ["ethers-solc", "ws"] } | ||
hyper = { workspace = true } | ||
humantime = { workspace = true } | ||
ibc-types = { workspace = true } | ||
metrics = { workspace = true } | ||
pin-project-lite = { workspace = true } | ||
prost = { workspace = true } | ||
serde = { workspace = true, features = ["derive"] } | ||
serde_json = { workspace = true } | ||
sha2 = { workspace = true } | ||
tendermint = { workspace = true } | ||
tracing = { workspace = true } | ||
tryhard = { workspace = true } | ||
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal"] } | ||
tokio-util = { workspace = true } | ||
|
||
astria-build-info = { path = "../astria-build-info", features = ["runtime"] } | ||
astria-core = { path = "../astria-core", features = ["serde", "server"] } | ||
astria-eyre = { path = "../astria-eyre" } | ||
config = { package = "astria-config", path = "../astria-config" } | ||
sequencer-client = { package = "astria-sequencer-client", path = "../astria-sequencer-client", features = [ | ||
"http", | ||
] } | ||
telemetry = { package = "astria-telemetry", path = "../astria-telemetry", features = [ | ||
"display", | ||
] } | ||
|
||
[dev-dependencies] | ||
astria-core = { path = "../astria-core", features = ["server", "test-utils"] } | ||
astria-grpc-mock = { path = "../astria-grpc-mock" } | ||
config = { package = "astria-config", path = "../astria-config", features = [ | ||
"tests", | ||
] } | ||
|
||
[build-dependencies] | ||
astria-build-info = { path = "../astria-build-info", features = ["build"] } |
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,4 @@ | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
astria_build_info::emit("bridge-withdrawer-v")?; | ||
Ok(()) | ||
} |
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,14 @@ | ||
# Compiler files | ||
cache/ | ||
out/ | ||
|
||
# Ignores development broadcast logs | ||
!/broadcast | ||
/broadcast/*/31337/ | ||
/broadcast/**/dry-run/ | ||
|
||
# Docs | ||
docs/ | ||
|
||
# Dotenv file | ||
.env |
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,38 @@ | ||
# astria-bridge-withdrawer | ||
|
||
Forge project for the bridge withdrawer contract. | ||
|
||
Requirements: | ||
|
||
- foundry | ||
|
||
Build: | ||
|
||
```sh | ||
forge build | ||
``` | ||
|
||
Copy the example .env: `cp local.example.env .env` | ||
|
||
Put your private key in `.env` and `source .env`. | ||
|
||
Deploy `AstriaWithdrawer.sol`: | ||
|
||
```sh | ||
forge script script/AstriaWithdrawer.s.sol:AstriaWithdrawerScript \ | ||
--rpc-url $RPC_URL --broadcast --sig "deploy()" -vvvv | ||
``` | ||
|
||
Call `withdrawToSequencer` in `AstriaWithdrawer.sol`: | ||
|
||
```sh | ||
forge script script/AstriaWithdrawer.s.sol:AstriaWithdrawerScript \ | ||
--rpc-url $RPC_URL --broadcast --sig "withdrawToSequencer()" -vvvv | ||
``` | ||
|
||
Call `withdrawToOriginChain` in `AstriaWithdrawer.sol`: | ||
|
||
```sh | ||
forge script script/AstriaWithdrawer.s.sol:AstriaWithdrawerScript \ | ||
--rpc-url $RPC_URL --broadcast --sig "withdrawToOriginChain()" -vvvv | ||
``` |
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,6 @@ | ||
[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 |
20 changes: 20 additions & 0 deletions
20
crates/astria-bridge-withdrawer/ethereum/local.env.example
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,20 @@ | ||
# private key to submit txs with | ||
PRIVATE_KEY=0x | ||
|
||
# default local rpc url | ||
RPC_URL="http://localhost:8545" | ||
|
||
# divide withdrawn values by 10^ASSET_WITHDRAWAL_DECIMALS | ||
ASSET_WITHDRAWAL_DECIMALS=12 | ||
|
||
# contract address | ||
ASTRIA_WITHDRAWER=0x5FbDB2315678afecb367f032d93F642f64180aa3 | ||
|
||
# destination chain address to withdraw to on the sequencer | ||
SEQUENCER_DESTINATION_CHAIN_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
|
||
# destination chain address to withdraw to on the origin chain | ||
ORIGIN_DESTINATION_CHAIN_ADDRESS="astring" | ||
|
||
# amount to withdraw | ||
AMOUNT=1000000000 |
1 change: 1 addition & 0 deletions
1
crates/astria-bridge-withdrawer/ethereum/out/AstriaWithdrawer.sol/AstriaWithdrawer.json
Large diffs are not rendered by default.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
crates/astria-bridge-withdrawer/ethereum/script/AstriaWithdrawer.s.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,46 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import {Script, console} from "forge-std/Script.sol"; | ||
import {AstriaWithdrawer} from "../src/AstriaWithdrawer.sol"; | ||
|
||
contract AstriaWithdrawerScript is Script { | ||
function setUp() public {} | ||
|
||
function deploy() public { | ||
uint32 assetWithdrawalDecimals = uint32(vm.envUint("ASSET_WITHDRAWAL_DECIMALS")); | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(deployerPrivateKey); | ||
AstriaWithdrawer astriaWithdrawer = new AstriaWithdrawer(assetWithdrawalDecimals); | ||
console.logAddress(address(astriaWithdrawer)); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function withdrawToSequencer() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
address contractAddress = vm.envAddress("ASTRIA_WITHDRAWER"); | ||
AstriaWithdrawer astriaWithdrawer = AstriaWithdrawer(contractAddress); | ||
|
||
address destinationChainAddress = vm.envAddress("SEQUENCER_DESTINATION_CHAIN_ADDRESS"); | ||
uint256 amount = vm.envUint("AMOUNT"); | ||
astriaWithdrawer.withdrawToSequencer{value: amount}(destinationChainAddress); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
||
function withdrawToOriginChain() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
address contractAddress = vm.envAddress("ASTRIA_WITHDRAWER"); | ||
AstriaWithdrawer astriaWithdrawer = AstriaWithdrawer(contractAddress); | ||
|
||
string memory destinationChainAddress = vm.envString("ORIGIN_DESTINATION_CHAIN_ADDRESS"); | ||
uint256 amount = vm.envUint("AMOUNT"); | ||
astriaWithdrawer.withdrawToOriginChain{value: amount}(destinationChainAddress, ""); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
Oops, something went wrong.