-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6355ad
commit c40e675
Showing
9 changed files
with
2,104 additions
and
168 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
use utils::deploy::{deploy1820::deploy1820, deploy_orderbook::deploy_orderbook}; | ||
use utils::{ | ||
deploy::{deploy1820::deploy1820, deploy_orderbook::deploy_orderbook}, | ||
utils::{deploy_anvil_and_docker, stop_docker}, | ||
}; | ||
|
||
mod utils; | ||
#[tokio::main] | ||
#[test] | ||
async fn orderbook_entity_test() -> anyhow::Result<()> { | ||
deploy1820().await?; | ||
deploy_orderbook().await?; | ||
let anvil = deploy_anvil_and_docker()?; | ||
deploy1820(&anvil).await?; | ||
deploy_orderbook(&anvil).await?; | ||
|
||
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
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pub mod deploy; | ||
pub mod utils; | ||
pub mod utils; |
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,35 @@ | ||
use web3::{transports::Http, Web3}; | ||
use anyhow::anyhow; | ||
use ethers::utils::{Anvil, AnvilInstance}; | ||
use std::process::Command; | ||
|
||
pub fn get_web3() -> Web3<Http> { | ||
let web3 = web3::Web3::new(Http::new("http://localhost:8545").unwrap()); | ||
web3 | ||
pub fn deploy_anvil_and_docker() -> anyhow::Result<AnvilInstance> { | ||
let proiver = Anvil::new().port(8545u16).spawn(); | ||
|
||
println!("Anvil deployed at : {}", proiver.endpoint()); | ||
// let output = Command::new("bash") | ||
// .args(&["-c", "docker-compose -f docker/docker-compose.yaml up -d"]) | ||
// .output() | ||
// .unwrap(); | ||
|
||
// if !output.status.success() { | ||
// let stderr = format!("{}", String::from_utf8_lossy(&output.stderr.to_vec())); | ||
// return Err(anyhow!(stderr)); | ||
// } | ||
Ok(proiver) | ||
} | ||
|
||
pub fn stop_docker() -> anyhow::Result<()> { | ||
let output = Command::new("bash") | ||
.args(&[ | ||
"-c", | ||
"docker-compose -f docker/docker-compose.yaml down && rm -rf docker/data ", | ||
]) | ||
.output() | ||
.unwrap(); | ||
|
||
if !output.status.success() { | ||
let stderr = format!("{}", String::from_utf8_lossy(&output.stderr.to_vec())); | ||
return Err(anyhow!(stderr)); | ||
} | ||
Ok(()) | ||
} |