forked from madara-alliance/madara-bootstrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.rs
116 lines (100 loc) · 3.17 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
pub mod constants;
mod erc20_bridge;
mod eth_bridge;
use constants::{
APP_CHAIN_ID, ETH_CHAIN_ID, ETH_PRIV_KEY, ETH_RPC, FEE_TOKEN_ADDRESS, L1_DEPLOYER_ADDRESS, L1_WAIT_TIME,
ROLLUP_PRIV_KEY, ROLLUP_SEQ_URL, SN_OS_CONFIG_HASH_VERSION, SN_OS_PROGRAM_HASH,
};
use rstest::rstest;
use crate::contract_clients::config::Config;
use crate::tests::constants::{L1_MULTISIG_ADDRESS, L2_MULTISIG_ADDRESS, OPERATOR_ADDRESS, VERIFIER_ADDRESS};
use crate::tests::erc20_bridge::erc20_bridge_test_helper;
use crate::tests::eth_bridge::eth_bridge_test_helper;
use crate::{bootstrap, CliArgs};
#[rstest]
#[tokio::test]
#[ignore]
async fn deploy_bridge() -> Result<(), anyhow::Error> {
env_logger::init();
bootstrap(&get_config()).await;
Ok(())
}
#[rstest]
#[tokio::test]
#[ignore]
async fn deposit_and_withdraw_eth_bridge() -> Result<(), anyhow::Error> {
env_logger::init();
let clients = Config::init(&get_config()).await;
let out = bootstrap(&get_config()).await;
let _ = eth_bridge_test_helper(
&clients,
&get_config(),
out.eth_proxy_address,
out.eth_bridge_proxy_address,
out.eth_bridge,
)
.await;
Ok(())
}
#[rstest]
#[tokio::test]
#[ignore]
async fn deposit_and_withdraw_erc20_bridge() -> Result<(), anyhow::Error> {
env_logger::init();
let clients = Config::init(&get_config()).await;
let out = bootstrap(&get_config()).await;
let _ = erc20_bridge_test_helper(
&clients,
&get_config(),
out.l2_erc20_token_address,
out.starknet_token_bridge,
out.erc20_l2_bridge_address,
)
.await;
Ok(())
}
#[rstest]
#[tokio::test]
async fn deposit_tests_both_bridges() -> Result<(), anyhow::Error> {
env_logger::init();
let clients = Config::init(&get_config()).await;
let out = bootstrap(&get_config()).await;
let _ = eth_bridge_test_helper(
&clients,
&get_config(),
out.eth_proxy_address,
out.eth_bridge_proxy_address,
out.eth_bridge,
)
.await;
let _ = erc20_bridge_test_helper(
&clients,
&get_config(),
out.l2_erc20_token_address,
out.starknet_token_bridge,
out.erc20_l2_bridge_address,
)
.await;
Ok(())
}
fn get_config() -> CliArgs {
CliArgs {
eth_rpc: String::from(ETH_RPC),
eth_priv_key: String::from(ETH_PRIV_KEY),
rollup_seq_url: String::from(ROLLUP_SEQ_URL),
rollup_priv_key: String::from(ROLLUP_PRIV_KEY),
eth_chain_id: String::from(ETH_CHAIN_ID).parse().unwrap(),
l1_deployer_address: String::from(L1_DEPLOYER_ADDRESS),
l1_wait_time: String::from(L1_WAIT_TIME),
sn_os_program_hash: String::from(SN_OS_PROGRAM_HASH),
config_hash_version: String::from(SN_OS_CONFIG_HASH_VERSION),
app_chain_id: String::from(APP_CHAIN_ID),
fee_token_address: String::from(FEE_TOKEN_ADDRESS),
cross_chain_wait_time: 120,
l1_multisig_address: String::from(L1_MULTISIG_ADDRESS),
l2_multisig_address: String::from(L2_MULTISIG_ADDRESS),
verifier_address: String::from(VERIFIER_ADDRESS),
operator_address: String::from(OPERATOR_ADDRESS),
dev: true,
}
}