Skip to content

Commit 2868e89

Browse files
committed
Add activate argument to deploy
1 parent 841b820 commit 2868e89

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

tests/stylus.rs

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ fn tests(required_forbidden_pairs: &[(&[&str], &[&str])]) {
110110
let (tempdir, address) = match deploy(
111111
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(path),
112112
contract,
113+
true,
113114
) {
114115
Ok((tempdir, address)) => (tempdir, address),
115116
Err(Error(severity, error)) => {
@@ -143,14 +144,15 @@ fn tests(required_forbidden_pairs: &[(&[&str], &[&str])]) {
143144
assert!(failures.is_empty());
144145
}
145146

146-
fn deploy(path: impl AsRef<Path>, contract: &str) -> Result<(TempDir, String)> {
147+
fn deploy(path: impl AsRef<Path>, contract: &str, activate: bool) -> Result<(TempDir, String)> {
147148
let tempdir = tempdir().unwrap();
148149
let dir = &tempdir;
149150

150151
let rust_toolchain_toml =
151152
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("integration/stylus/rust-toolchain.toml");
152153
copy(rust_toolchain_toml, dir.path().join("rust-toolchain.toml")).unwrap();
153154

155+
// smoelius: Compile.
154156
command(
155157
dir,
156158
[
@@ -165,31 +167,26 @@ fn deploy(path: impl AsRef<Path>, contract: &str) -> Result<(TempDir, String)> {
165167
],
166168
)?;
167169

168-
command(
169-
dir,
170-
[
171-
"cargo",
172-
"stylus",
173-
"check",
174-
&format!("--wasm-file={contract}.wasm"),
175-
],
176-
)
177-
.unwrap();
170+
let wasm_file = format!("--wasm-file={contract}.wasm");
178171

179-
let stdout = command(
180-
dir,
181-
[
182-
"cargo",
183-
"stylus",
184-
"deploy",
185-
&format!("--wasm-file={contract}.wasm"),
186-
"--endpoint=http://localhost:8547",
187-
"--private-key",
188-
PRIVATE_KEY,
189-
"--no-verify",
190-
],
191-
)
192-
.unwrap();
172+
// smoelius: Check.
173+
command(dir, ["cargo", "stylus", "check", &wasm_file]).unwrap();
174+
175+
// smoelius: Deploy.
176+
let mut deploy_args = vec![
177+
"cargo",
178+
"stylus",
179+
"deploy",
180+
&wasm_file,
181+
"--endpoint=http://localhost:8547",
182+
"--private-key",
183+
PRIVATE_KEY,
184+
"--no-verify",
185+
];
186+
if !activate {
187+
deploy_args.push("--no-activate");
188+
}
189+
let stdout = command(dir, deploy_args).unwrap();
193190

194191
let address = stdout
195192
.lines()

tests/stylus_tests/counter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ fn counter() {
1919
let (tempdir, address) = deploy(
2020
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("integration/stylus/counter.sol"),
2121
"Counter",
22+
true,
2223
)
2324
.unwrap();
2425
let dir = &tempdir;

tests/stylus_tests/milestone_1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn milestone_1() {
1515
let (tempdir, address) = deploy(
1616
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("integration/stylus/milestone_1.sol"),
1717
"C",
18+
true,
1819
)
1920
.unwrap();
2021
let dir = &tempdir;

tests/stylus_tests/milestone_2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn milestone_2() {
1515
let (tempdir, address) = deploy(
1616
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("integration/stylus/milestone_2.sol"),
1717
"C",
18+
true,
1819
)
1920
.unwrap();
2021
let dir = &tempdir;

tests/stylus_tests/milestone_3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fn milestone_3() {
1616
let (tempdir, address) = deploy(
1717
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("integration/stylus/milestone_3.sol"),
1818
"C",
19+
true,
1920
)
2021
.unwrap();
2122
let dir = &tempdir;

tests/stylus_tests/value.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn value() {
1515
let (tempdir, address) = deploy(
1616
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("integration/stylus/value.sol"),
1717
"C",
18+
true,
1819
)
1920
.unwrap();
2021
let dir = &tempdir;

0 commit comments

Comments
 (0)