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

Deposit erc20 tokens #80

Merged
merged 82 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
234cb6e
Add ETH L2 contract address
IAvecilla Jun 7, 2023
874206d
Start withdraw implementation
IAvecilla Jun 7, 2023
c340627
Parse eth amount to wei
IAvecilla Jun 7, 2023
d77fced
Sign and send withdraw transaction
IAvecilla Jun 7, 2023
2e55087
Add address of messenger on L1
IAvecilla Jun 8, 2023
a211878
Update types to U64 from ethers
IAvecilla Jun 8, 2023
9716543
Start finalize withdraw function
IAvecilla Jun 8, 2023
06a7229
Add test for withdraw function
IAvecilla Jun 8, 2023
f95b83f
Merge branch 'main' into withdraw
IAvecilla Jun 8, 2023
fbde008
Change field name of Proof struct to merkle proof
IAvecilla Jun 8, 2023
f93bdc3
Finish finalize withdraw function along with the test
IAvecilla Jun 8, 2023
9706abf
Fix format
IAvecilla Jun 9, 2023
a0e03b7
Add override struct to override transaction fields
IAvecilla Jun 9, 2023
91ae369
Fix withdraw and test case
IAvecilla Jun 9, 2023
70f68ef
Delete estimate_gas function for ZKSProvider
IAvecilla Jun 9, 2023
cb54ead
Use L1 provider for finalize withdraw
IAvecilla Jun 9, 2023
f147f1d
Revert "Delete estimate_gas function for ZKSProvider"
IAvecilla Jun 12, 2023
2e85a99
Add max fee per gas constant
IAvecilla Jun 13, 2023
8a01eff
Change endpoint name to avoid collision between L1 and L2 nodes
IAvecilla Jun 13, 2023
11ecdaf
Fix transaction for finalize withdraw
IAvecilla Jun 13, 2023
fc60b5d
Fix finalize withdraw test
IAvecilla Jun 13, 2023
656170f
Parse withdraw amount to wei
IAvecilla Jun 13, 2023
bbe4324
Cleanup
ilitteri Jun 13, 2023
543817c
Add correct calculation for l2 to l1 log index
IAvecilla Jun 14, 2023
b9d369f
Clean the finalize withdraw function
IAvecilla Jun 15, 2023
56c487e
Fix panic in finalize withdraw
IAvecilla Jun 15, 2023
5e428d2
Add a sleep to wait to the proof to be posted on L1.
mpaulucci Jun 15, 2023
3a411f8
Merge branch 'main' into withdraw
IAvecilla Jun 16, 2023
7f9bd2a
Move send function to providers
IAvecilla Jun 16, 2023
381a7e3
Fix "unknown account" error
ilitteri Jun 17, 2023
6ecd168
Fix finalize tx receipt
ilitteri Jun 17, 2023
a5205d9
Use tokio for sleep when withdrawing
ilitteri Jun 17, 2023
6c02af9
Add default value for gas
IAvecilla Jun 21, 2023
eb0c952
Fix clippy lints
IAvecilla Jun 21, 2023
b6483ee
Move send test to provider
IAvecilla Jun 21, 2023
6235fcb
Remove FIXME
ilitteri Jun 22, 2023
ba30a9b
Remove FIXME
ilitteri Jun 22, 2023
3b99993
Remove FIXME
ilitteri Jun 22, 2023
fa85ac9
Add another wallet in L1 for ZKSWallet creation
IAvecilla Jun 22, 2023
bf28822
Merge branch 'main' into withdraw
IAvecilla Jun 22, 2023
b42df44
Add address as parameter in withdraw function
IAvecilla Jun 22, 2023
8d2935d
Fix clippy
IAvecilla Jun 23, 2023
3da367c
Create DepositRequest structure
jpcenteno Jun 26, 2023
8251e37
Implement other DepositRequest parameters
jpcenteno Jun 26, 2023
ba5558d
Make DepositRequest public
jpcenteno Jun 28, 2023
c1272f0
Use crate types
jpcenteno Jun 29, 2023
98f0f19
Fix gas limit setter
jpcenteno Jun 29, 2023
476b1dd
Fix gas_price setter
jpcenteno Jun 29, 2023
cda7591
Fix operator tip setter
jpcenteno Jun 29, 2023
4ce4ed9
Fix l2_gas_limit setter
jpcenteno Jun 30, 2023
7bac27f
Fix gas_per_pubdata_byte setter
jpcenteno Jun 30, 2023
f12ff57
Merge branch 'main' into extend-deposit
jpcenteno Jun 30, 2023
6834725
Merge branch 'main' into extend-deposit
jpcenteno Jul 6, 2023
e994021
Remove unused sleeps
jpcenteno Jul 6, 2023
c634abc
Fix operator_tip setter
jpcenteno Jul 6, 2023
fa6b63a
Write ERC20 deposit test
jpcenteno Jul 6, 2023
9c1ef77
Merge branch 'main' into deposit-erc20-tokens
jpcenteno Jul 6, 2023
5aa75c1
Fix ERC20 deposit test
jpcenteno Jul 7, 2023
b0564c0
WIP ERC20 deposit implementation
jpcenteno Jul 7, 2023
2c61919
Merge branch 'main' into deposit-erc20-tokens
jpcenteno Jul 10, 2023
49859e8
Simplify ERC20 deposit test
jpcenteno Jul 10, 2023
fe09f1f
Remove unused imports
jpcenteno Jul 10, 2023
62c9f16
WIP ERC20 deposit implementation
jpcenteno Jul 12, 2023
fdc32bc
Include token approval call for erc20 deposit
IAvecilla Jul 19, 2023
067cdc8
Merge branch 'main' into deposit-erc20-tokens
jpcenteno Jul 20, 2023
56b07df
Add dep on lazy static
jpcenteno Jul 24, 2023
7663f00
Fix clippy errors
jpcenteno Jul 24, 2023
1dbc6a5
Merge branch 'main' into deposit-erc20-tokens
jpcenteno Jul 25, 2023
96eb15f
Fix clippy errors
jpcenteno Jul 25, 2023
fea44ea
Fix approve_erc20
jpcenteno Jul 26, 2023
3a6436e
Skip ERC20 deposit test
jpcenteno Jul 26, 2023
b477a88
Add newline at EOF
jpcenteno Jul 26, 2023
82dc218
Fix lines that were removed by mistake
jpcenteno Jul 26, 2023
b5d56ed
Remove outdated comment
jpcenteno Jul 27, 2023
5c068bd
Remove debug prints
jpcenteno Aug 28, 2023
4147232
Remove unnecesary setter call
jpcenteno Aug 28, 2023
741d8df
Replace magic numbers with constants
jpcenteno Aug 28, 2023
392ef65
Make ABI loader private so we can use expect calls
jpcenteno Aug 28, 2023
9b27618
Make Ether the default token for deposit requests
jpcenteno Aug 28, 2023
41afa0e
Remove outdated comment
jpcenteno Aug 28, 2023
dba4149
Merge branch 'main' into deposit-erc20-tokens
jpcenteno Aug 29, 2023
4d2ff44
Fix ERC20 deposit test
jpcenteno Aug 29, 2023
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ edition = "2021"
ethers = { version = "2.0.4", features = ["rustls"] }
ethers-contract = "2.0.7"
clap = { version = "4.2.7", features = ["derive"] }
lazy_static = "1.4.0"

# Async
tokio = { version = "1", features = ["macros", "process"] }
Expand Down
10,232 changes: 10,232 additions & 0 deletions resources/testing/erc20/ERC20Token.json

Large diffs are not rendered by default.

286 changes: 286 additions & 0 deletions resources/testing/erc20/MyToken.json

Large diffs are not rendered by default.

277 changes: 277 additions & 0 deletions resources/testing/erc20/abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "subtractedValue",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "addedValue",
"type": "uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
Loading