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

rework: New SDK zksync-ethers-rs #129

Draft
wants to merge 80 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
5b88fae
Rename crate
ilitteri Jul 10, 2024
f13a81b
Rename utils module
ilitteri Jul 10, 2024
c336a51
Add new ABIs and move ABIs dir to root
ilitteri Jul 10, 2024
72e9152
Remove old l1 bridge contract implementation
ilitteri Jul 10, 2024
2dcf554
Add types module
ilitteri Jul 10, 2024
f4e7af3
Remove abi module decl from lib
ilitteri Jul 10, 2024
b24e143
Move tests to root dir
ilitteri Jul 10, 2024
dfd2c9d
Update main contract's ABI
ilitteri Jul 10, 2024
9f81d74
Replace ZKSProvider with ZKMiddleware
ilitteri Jul 10, 2024
00c30d3
Remove old wallet impl
ilitteri Jul 10, 2024
e37aeee
Add L1TxOverrides type
ilitteri Jul 10, 2024
2e39ce7
Update lib.rs
ilitteri Jul 10, 2024
5a89ebc
Update zk_middleware imports
ilitteri Jul 10, 2024
f5f7958
Add Bridgehub impl
ilitteri Jul 10, 2024
a4f6255
Add ERC20 impl
ilitteri Jul 10, 2024
2367f41
Add L1SharedBridge impl
ilitteri Jul 10, 2024
ee2db53
Declare contract modules
ilitteri Jul 10, 2024
7edd3ca
Add deposit new middle-level implementation
ilitteri Jul 10, 2024
4466bd7
Update Cargo.lock
ilitteri Jul 10, 2024
879a286
Comment deprecated tests
ilitteri Jul 10, 2024
8cb286a
Update imports
ilitteri Jul 10, 2024
a0adea8
Comment old impl
ilitteri Jul 10, 2024
42c4cdb
Add base token implementation
ilitteri Jul 11, 2024
6845eef
First withdraw impl
ilitteri Jul 11, 2024
6eed031
Refactors
ilitteri Jul 11, 2024
1172347
First withdraw refactor
ilitteri Jul 12, 2024
9aa8cac
Update tests suites
ilitteri Aug 7, 2024
77c4a15
Refactor deposit module
ilitteri Aug 7, 2024
3b8b4fc
Add L2SharedBridge instance
ilitteri Aug 7, 2024
07edc68
Refactor withdraw
ilitteri Aug 7, 2024
ef2810d
Add gas_limit to L1TxOverrides
ilitteri Aug 7, 2024
9546413
Add new dep
ilitteri Aug 7, 2024
bd6a5b5
Remove old stuff
ilitteri Aug 13, 2024
2641190
Update README
ilitteri Aug 13, 2024
87b5dd4
Update deposit
ilitteri Aug 13, 2024
6f6ba00
Remove withdraw tests from withdraw module
ilitteri Aug 13, 2024
42839a9
Implement missing JSON-RPC API methods
ilitteri Aug 13, 2024
c7d3659
Update test helpers
ilitteri Aug 13, 2024
62ef75b
Update deposit tests
ilitteri Aug 13, 2024
061be3d
Add withdraw tests
ilitteri Aug 13, 2024
ca4c4ca
Cleanup
ilitteri Aug 13, 2024
ed3111b
Cleanup deposit
ilitteri Aug 13, 2024
7679e83
Refactor withdraw
ilitteri Aug 13, 2024
e502346
Add transfer low-level module
ilitteri Aug 13, 2024
6671dc1
Fix withdraw tests
ilitteri Aug 13, 2024
8f8157d
Add `ZKWallet` implementation
ilitteri Aug 13, 2024
dddd9c3
Implement deposit, withdraw, and transfers of base token
ilitteri Aug 13, 2024
528fa37
Implement deposit_base_token_to for ZKWallet
ilitteri Aug 13, 2024
fe08fc0
Refactor deposit
ilitteri Aug 14, 2024
1c99926
Fix base token transfers
ilitteri Aug 14, 2024
50e6682
Update test
ilitteri Aug 14, 2024
23942ec
Remove old tests
ilitteri Aug 14, 2024
25883f6
feat(l2_token_addr): add a function to get the l2 token addr (#128)
fborello-lambda Aug 14, 2024
f0fabca
Refactor deposit module
ilitteri Aug 15, 2024
666342f
Add Governance implementation
ilitteri Aug 16, 2024
0d2d2bb
Update IBridgehub
ilitteri Aug 19, 2024
60d156f
Use Bridgehub ABI instead of IBrideghub (more complete)
ilitteri Aug 19, 2024
68a63c9
feat(transfer): add Overrides field that overrides nonce (#130)
fborello-lambda Aug 19, 2024
6a81b46
Refactor
ilitteri Aug 20, 2024
8ffbec9
feat(mint-erc20): add abi interface
fborello-lambda Aug 20, 2024
8a9de6b
Merge pull request #131 from lambdaclass/fd-mint-ierc20
fborello-lambda Aug 20, 2024
5e18ae8
remove(wait_for_finalize_withdrawal): print msg
fborello-lambda Aug 21, 2024
43f507e
Use zksync-era main
ilitteri Aug 29, 2024
fd5567c
Add StateTransitionManager
ManuelBilbao Aug 30, 2024
a351edc
Add state_transition_manager to mod.rs
ManuelBilbao Aug 30, 2024
904dfa6
Use STM instead of ISTM
ManuelBilbao Sep 4, 2024
952fbff
fix(zksync_types): redeclare api
fborello-lambda Sep 10, 2024
dd28f08
Merge pull request #135 from lambdaclass/fix/zksync_types_api_access
fborello-lambda Sep 10, 2024
5d5b148
feat: deploy with eip-712
fborello-lambda Sep 11, 2024
ff3110c
add send_transaction_eip712 to zk_wallet
fborello-lambda Sep 11, 2024
dbe148d
Merge branch 'main' into zksync-ethers-rs-v1
IAvecilla Sep 13, 2024
8b57b3a
Merge branch 'zksync-ethers-rs-v1' into feat/deploy_eip712
IAvecilla Sep 13, 2024
745420b
wip: add fixes
fborello-lambda Sep 13, 2024
adb9baa
Fix deploy and handle errors
IAvecilla Sep 19, 2024
7fe5901
Remove allow unwrap for zk wallet
IAvecilla Sep 19, 2024
5144372
Rename error for sending eip712 transaction
IAvecilla Sep 19, 2024
3ad4a82
Remove send eip712 from middleware
IAvecilla Sep 19, 2024
a1dbfa3
wip: investigate how to set gas_per_pubdata dynamically
fborello-lambda Sep 20, 2024
1356be6
add todo comment
fborello-lambda Sep 20, 2024
1147760
Merge pull request #136 from lambdaclass/feat/deploy_eip712
fborello-lambda Sep 20, 2024
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
7,817 changes: 5,890 additions & 1,927 deletions Cargo.lock

Large diffs are not rendered by default.

26 changes: 18 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "zksync-web3-rs"
name = "zksync-ethers-rs"
version = "0.2.1"
edition = "2021"
license = "MIT"
description = "Rust SDK for zkSync Era"
repository = "https://github.com/lambdaclass/zksync-web3-rs/"
homepage = "https://github.com/lambdaclass/zksync-web3-rs/"
repository = "https://github.com/lambdaclass/zksync-ethers-rs/"
homepage = "https://github.com/lambdaclass/zksync-ethers-rs/"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -15,6 +15,13 @@ ethers-contract = "2.0.7"
clap = { version = "4.2.7", features = ["derive"] }
lazy_static = "1.4.0"

# ZKsync
zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", package = "zksync_types" }
zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", package = "zksync_web3_decl" }
zksync_system_constants = { git = "https://github.com/matter-labs/zksync-era.git", package = "zksync_system_constants" }
zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", package = "zksync_contracts" }
zksync_prover_interface = { git = "https://github.com/matter-labs/zksync-era.git", package = "zksync_prover_interface" }

# Async
tokio = { version = "1", features = ["macros", "process"] }
async-trait = "0.1.68"
Expand All @@ -29,20 +36,23 @@ thiserror = "1.0.40" # Library error handling

# Logging
log = "0.4"
env_logger = "0.10"
env_logger = "0.11.3"

# Hash
sha2 = "0.9.5"
sha2 = "0.10.8"
anyhow = "1.0.88"

[features]
ethers-solc = ["ethers/ethers-solc"]

[dev-dependencies]
colored = "2.1.0"

# Examples

[[example]]
name = "simple_payment"
path = "examples/simple_payment/main.rs"
#[[example]]
#name = "simple_payment"
#path = "examples/simple_payment/main.rs"

[profile.test]
opt-level = 3
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,42 @@
- [Run the Simple Transfer Example](#run-the-simple-transfer-example)
- [Conclusion](#conclusion)

## Features

### Low-Level API

| Feature | Status |
| ------- | ------ |
| Deposit ETH to ETH base chain | ✔️ |
| Deposit ETH to ERC20 base chain | 🏗️ |
| Deposit ERC20 to ETH base chain | 🏗️ |
| Deposit ERC20 to other ERC20 base chain | 🏗️ |
| Deposit ERC20 to same ERC20 base chain | 🏗️ |
| Withdraw ETH from ETH base chain | ✔️ |
| Withdraw ETH from ERC20 base chain | 🏗️ |
| Withdraw ERC20 from ETH base chain | 🏗️ |
| Withdraw ERC20 from other ERC20 base chain | 🏗️ |
| Withdraw ERC20 from same ERC20 base chain | 🏗️ |
| Transfer ETH | ❌ |
| Transfer ERC20 | ❌ |

### ZKwallet

| Feature | Status |
| ------- | ------ |
| Deposit ETH to ETH base chain | ❌ |
| Deposit ETH to ERC20 base chain | ❌ |
| Deposit ERC20 to ETH base chain | ❌ |
| Deposit ERC20 to other ERC20 base chain | ❌ |
| Deposit ERC20 to same ERC20 base chain | ❌ |
| Withdraw ETH from ETH base chain | ❌ |
| Withdraw ETH from ERC20 base chain | ❌ |
| Withdraw ERC20 from ETH base chain | ❌ |
| Withdraw ERC20 from other ERC20 base chain | ❌ |
| Withdraw ERC20 from same ERC20 base chain | ❌ |
| Transfer ETH | ❌ |
| Transfer ERC20 | ❌ |

## Getting Started with zkSync Web3 SDK

While most of the existing SDKs should work out of the box, deploying smart contracts or using unique zkSync features, like account abstraction, requires providing additional fields to those that Ethereum transactions have by default.
Expand Down
Loading
Loading