-
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.
Refactor get_client to support both ws and http Add helper functions to config
- Loading branch information
Showing
70 changed files
with
3,280 additions
and
1,701 deletions.
There are no files selected for viewing
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
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
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,113 @@ | ||
use alloy_primitives::{address, Address}; | ||
use alloy_provider::Provider; | ||
use gadget_sdk::info; | ||
use gadget_sdk::{ | ||
config::protocol::EigenlayerContractAddresses, events_watcher::evm::get_provider_http, | ||
}; | ||
|
||
use crate::helpers::get_receipt; | ||
|
||
alloy_sol_types::sol!( | ||
#[allow(missing_docs)] | ||
#[sol(rpc)] | ||
#[derive(Debug)] | ||
IncredibleSquaringTaskManager, | ||
"./../blueprints/incredible-squaring-eigenlayer/contracts/out/IncredibleSquaringTaskManager.sol/IncredibleSquaringTaskManager.json" | ||
); | ||
|
||
alloy_sol_types::sol!( | ||
#[allow(missing_docs)] | ||
#[sol(rpc)] | ||
#[derive(Debug)] | ||
PauserRegistry, | ||
"./../blueprints/incredible-squaring-eigenlayer/contracts/out/IPauserRegistry.sol/IPauserRegistry.json" | ||
); | ||
|
||
alloy_sol_types::sol!( | ||
#[allow(missing_docs, clippy::too_many_arguments)] | ||
#[sol(rpc)] | ||
#[derive(Debug)] | ||
RegistryCoordinator, | ||
"./../blueprints/incredible-squaring-eigenlayer/contracts/out/RegistryCoordinator.sol/RegistryCoordinator.json" | ||
); | ||
|
||
pub struct EigenlayerTestEnvironment { | ||
pub http_endpoint: String, | ||
pub ws_endpoint: String, | ||
pub accounts: Vec<Address>, | ||
pub eigenlayer_contract_addresses: EigenlayerContractAddresses, | ||
pub pauser_registry_address: Address, | ||
} | ||
|
||
pub async fn setup_eigenlayer_test_environment( | ||
http_endpoint: &str, | ||
ws_endpoint: &str, | ||
) -> EigenlayerTestEnvironment { | ||
let provider = get_provider_http(http_endpoint); | ||
|
||
let accounts = provider.get_accounts().await.unwrap(); | ||
|
||
let registry_coordinator_address = address!("c3e53f4d16ae77db1c982e75a937b9f60fe63690"); | ||
std::env::set_var( | ||
"REGISTRY_COORDINATOR_ADDR", | ||
registry_coordinator_address.to_string(), | ||
); | ||
let operator_state_retriever_address = address!("1613beb3b2c4f22ee086b2b38c1476a3ce7f78e8"); | ||
std::env::set_var( | ||
"OPERATOR_STATE_RETRIEVER_ADDR", | ||
operator_state_retriever_address.to_string(), | ||
); | ||
let delegation_manager_address = address!("dc64a140aa3e981100a9beca4e685f962f0cf6c9"); | ||
std::env::set_var( | ||
"DELEGATION_MANAGER_ADDR", | ||
delegation_manager_address.to_string(), | ||
); | ||
let strategy_manager_address = address!("5fc8d32690cc91d4c39d9d3abcbd16989f875707"); | ||
std::env::set_var( | ||
"STRATEGY_MANAGER_ADDR", | ||
strategy_manager_address.to_string(), | ||
); | ||
let erc20_mock_address = address!("7969c5ed335650692bc04293b07f5bf2e7a673c0"); | ||
std::env::set_var("ERC20_MOCK_ADDR", erc20_mock_address.to_string()); | ||
|
||
let pauser_registry = PauserRegistry::deploy(provider.clone()).await.unwrap(); | ||
let pauser_registry_address = *pauser_registry.address(); | ||
|
||
let registry_coordinator = | ||
RegistryCoordinator::new(registry_coordinator_address, provider.clone()); | ||
|
||
let operator_set_params = RegistryCoordinator::OperatorSetParam { | ||
maxOperatorCount: 10, | ||
kickBIPsOfOperatorStake: 100, | ||
kickBIPsOfTotalStake: 1000, | ||
}; | ||
let strategy_params = RegistryCoordinator::StrategyParams { | ||
strategy: erc20_mock_address, | ||
multiplier: 1, | ||
}; | ||
|
||
info!("Creating Quorum"); | ||
let _receipt = get_receipt(registry_coordinator.createQuorum( | ||
operator_set_params, | ||
0, | ||
vec![strategy_params], | ||
)) | ||
.await | ||
.unwrap(); | ||
|
||
info!("Setup Eigenlayer test environment"); | ||
|
||
EigenlayerTestEnvironment { | ||
http_endpoint: http_endpoint.to_string(), | ||
ws_endpoint: ws_endpoint.to_string(), | ||
accounts, | ||
eigenlayer_contract_addresses: EigenlayerContractAddresses { | ||
registry_coordinator_address, | ||
operator_state_retriever_address, | ||
delegation_manager_address, | ||
strategy_manager_address, | ||
avs_directory_address: Default::default(), | ||
}, | ||
pauser_registry_address, | ||
} | ||
} |
Oops, something went wrong.