-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a pause script to
test-utils
(#644)
* Added a pause script to `test-utils` * Improved the output * Added some documentation about running the scripts
- Loading branch information
1 parent
1148b95
commit 3c9bcea
Showing
6 changed files
with
96 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use std::env; | ||
|
||
use dotenvy::dotenv; | ||
use ethers::signers::LocalWallet; | ||
use eyre::Result; | ||
use hyperdrive_wrappers::wrappers::ierc4626_hyperdrive::IERC4626Hyperdrive; | ||
use test_utils::chain::{Chain, DevChain, MNEMONIC}; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
// Connect to the chain and set up an agent with the provided envvars. | ||
dotenv().expect("Failed to load .env file"); | ||
let chain = DevChain::new( | ||
&env::var("HYPERDRIVE_ETHEREUM_URL")?, | ||
&env::var("HYPERDRIVE_ARTIFACTS_URL")?, | ||
MNEMONIC, | ||
0, | ||
) | ||
.await?; | ||
let client = chain | ||
.client(env::var("HYPERDRIVE_PRIVATE_KEY")?.parse::<LocalWallet>()?) | ||
.await?; | ||
|
||
// Pause the pool. | ||
println!("Pausing the pool..."); | ||
let hyperdrive = IERC4626Hyperdrive::new(chain.addresses().hyperdrive, client); | ||
hyperdrive.pause(true).send().await?.await?; | ||
|
||
// Check that the pool is paused. | ||
let market_state = hyperdrive.get_market_state().call().await?; | ||
if market_state.is_paused { | ||
println!("The pool was successfully paused!"); | ||
} else { | ||
panic!("The pool was not paused!"); | ||
} | ||
|
||
Ok(()) | ||
} |